@paperbits/core
Version:
Paperbits core components.
35 lines (31 loc) • 1.27 kB
text/typescript
import * as ko from "knockout";
import template from "./workshops.html";
import { ViewManager, View, ToolButton } from "@paperbits/common/ui";
import { UserService } from "@paperbits/common/user";
import { Component, OnMounted } from "@paperbits/common/ko/decorators";
({
selector: "workshops",
template: template
})
export class Workshops {
public userPhotoUrl: ko.Observable<string>;
public resizing: ko.Computed<string>;
public sections: ko.ObservableArray<ToolButton>;
constructor(
private readonly viewManager: ViewManager,
private readonly userService: UserService,
private readonly workshopSections: ToolButton[]
) {
this.userPhotoUrl = ko.observable<string>(null);
this.resizing = ko.pureComputed(() => this.viewManager.journeyName() ? "vertically horizontally" : "vertically horizontally suspended");
this.sections = ko.observableArray(this.workshopSections);
}
()
public async loadUserProfile(): Promise<void> {
const url = await this.userService.getUserPhotoUrl();
this.userPhotoUrl(url);
}
public closeWorkshop(view: View): void {
this.viewManager.closeWorkshop(view);
}
}