Mercurial > code > home > repos > light9
view web/TiledHome.ts @ 2402:1d3594ffd14b
new home-status elt
author | drewp@bigasterisk.com |
---|---|
date | Fri, 17 May 2024 16:56:32 -0700 |
parents | 40d5a54dec99 |
children | d8950f9b46be 69ca2b2fc133 |
line wrap: on
line source
import debug from "debug"; import * as FlexLayout from "flexlayout-react"; import { LitElement, html } from "lit"; import { customElement } from "lit/decorators.js"; import * as React from "react"; import { createRoot } from "react-dom/client"; import { getTopGraph } from "./RdfdbSyncedGraph"; import { SyncedGraph } from "./SyncedGraph"; import { Patch } from "./patch"; import { NamedNode } from "n3"; export { RdfdbSyncedGraph } from "./RdfdbSyncedGraph"; export { Light9CollectorUi } from "./collector/Light9CollectorUi"; export { Light9FadeUi } from "./fade/Light9FadeUi"; export { Light9DeviceSettings } from "./live/Light9DeviceSettings"; import { showRoot } from "./show_specific"; import { HandlerFunc } from "./AutoDependencies"; const log = debug("home"); const config: FlexLayout.IJsonModel = { global: { tabEnableRename: false, }, borders: [], layout: { type: "row", weight: 100, children: [ { type: "tabset", weight: 50, children: [{ type: "tab", name: "devsettings", component: "light9-device-settings" }], }, { type: "tabset", weight: 50, children: [{ type: "tab", name: "collector", component: "light9-collector-ui" }], }, ], }, }; // see https://github.com/lit/lit/tree/main/packages/labs/react class Main extends React.Component { state: { model: FlexLayout.Model }; constructor(props: any) { super(props); this.state = { model: FlexLayout.Model.fromJson(config) }; } factory = (node: any) => { var component = node.getComponent(); return React.createElement(component, null, ""); }; render() { return React.createElement(FlexLayout.Layout, { model: this.state.model, realtimeResize: true, factory: this.factory, }); } } @customElement("light9-home-status") export class Light9HomeStatus extends LitElement { graph!: SyncedGraph; render() { return html`<rdfdb-synced-graph></rdfdb-synced-graph> <a href="metrics/">metrics</a> `; } constructor() { super(); getTopGraph().then((g) => { this.graph = g; }); } } const root = createRoot(document.getElementById("container")!); root.render(React.createElement(Main));