Files
frm.so/ui/desktop/components/AppWindow.js

52 lines
1.4 KiB
JavaScript

import "../apps/Dashboard/Dashboard.js"
import "../apps/Forum/Forum.js"
import "../apps/Tasks/Tasks.js"
import "../apps/Messages/Messages.js"
import "../apps/Market/Market.js"
import "../apps/Jobs/Jobs.js"
class AppWindow extends Shadow {
calculateWidth() {
let sidebar = $("sidebar-").getBoundingClientRect()
let w = sidebar.width
return w
}
calculateHeight() {
let appmenu = $("app-menu").getBoundingClientRect()
let h = appmenu.height
return h
}
render() {
ZStack(() => {
switch(window.currentApp) {
case "Dashboard":
Dashboard()
break;
case "Forum":
Forum()
break;
case "Messages":
Messages()
break;
case "Market":
Market()
break;
case "Jobs":
Jobs()
break;
}
})
.position("fixed")
.width(window.innerWidth - this.calculateWidth(), px)
.height(window.innerHeight - this.calculateHeight(), px)
.background("var(--app)")
.x(this.calculateWidth(), px)
.yBottom(this.calculateHeight(), px)
.onEvent("appchange", () => this.rerender())
}
}
register(AppWindow, "app-window")