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"; @Component({ selector: "workshops", template: template }) export class Workshops { public userPhotoUrl: ko.Observable; public resizing: ko.Computed; public sections: ko.ObservableArray; constructor( private readonly viewManager: ViewManager, private readonly userService: UserService, private readonly workshopSections: ToolButton[] ) { this.userPhotoUrl = ko.observable(null); this.resizing = ko.pureComputed(() => this.viewManager.journeyName() ? "vertically horizontally" : "vertically horizontally suspended"); this.sections = ko.observableArray(this.workshopSections); } @OnMounted() public async loadUserProfile(): Promise { const url = await this.userService.getUserPhotoUrl(); this.userPhotoUrl(url); } public closeWorkshop(view: View): void { this.viewManager.closeWorkshop(view); } }