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 {
    app;

    constructor(app) {
        super()
        this.app = app
    }

    render() {
        ZStack(() => {
            switch(this.app) {
                case "Forum":
                    Forum()
                    break;
                case "Messages":
                    Messages()
                    break;
                case "Market":
                    Market()
                    break;
                case "Jobs":
                    Jobs()
                    break;
            }
        })
        .position("fixed")
        .display(this.app ? 'block' : 'none')
        .width(100, "vw")
        .height(100, "vh")
        .background("#591d10")
        .x(0)
        .y(0)
        // .backgroundImage("/_/images/fabric.png")
        // .backgroundSize("33vw auto")
    }

    open(app) {
        this.app = app
        this.rerender()
    }

    close() {
        this.style.display = "none"
    }

}

register(AppWindow, "app-window")