import { LitElement, html, css } from "lit"; import { store} from "../store/index.js"; import { StoreController } from "../controllers/store-controller.js"; import "./nav-bar.js"; import "./page-home.js"; import "./page-items.js"; class AppRoot extends LitElement { #hydrated = new StoreController(this, store, s => s._hydrated); #user = new StoreController(this, store, s => s.user); #route = new StoreController(this, store, s => s.route); static styles = css` :host { display: block; min-height: 100vh; } .loading { display: grid; place-items: center; height: 100vh; opacity: 0.4; } `; render() { if (!this.#hydrated.value) { return html`
loading...
`; } return html`
${this.#renderRoute()}
`; } #renderRoute() { switch (this.#route.value) { case "home": return html``; case "items": return html``; default: return html``; } } } customElements.define('app-root', AppRoot);