Mercurial > code > home > repos > light9
comparison web/TiledHome.ts @ 2376:4556eebe5d73
topdir reorgs; let pdm have its src/ dir; separate vite area from light9/
author | drewp@bigasterisk.com |
---|---|
date | Sun, 12 May 2024 19:02:10 -0700 |
parents | light9/web/TiledHome.ts@9d47c44d4ae4 |
children | 40d5a54dec99 |
comparison
equal
deleted
inserted
replaced
2375:623836db99af | 2376:4556eebe5d73 |
---|---|
1 import * as React from "react"; | |
2 import { createRoot } from "react-dom/client"; | |
3 import * as FlexLayout from "flexlayout-react"; | |
4 export { Light9DeviceSettings } from "./live/Light9DeviceSettings"; | |
5 export { Light9CollectorUi } from "./collector/Light9CollectorUi"; | |
6 | |
7 const config:FlexLayout.IJsonModel = { | |
8 global: {}, | |
9 borders: [], | |
10 layout: { | |
11 type: "row", | |
12 weight: 100, | |
13 children: [ | |
14 { | |
15 type: "tabset", | |
16 weight: 50, | |
17 children: [{ type: "tab", name: "devsettings", component: "light9-device-settings" }], | |
18 }, | |
19 { | |
20 type: "tabset", | |
21 weight: 50, | |
22 children: [{ type: "tab", name: "collector", component: "light9-collector-ui" }], | |
23 }, | |
24 ], | |
25 }, | |
26 }; | |
27 | |
28 const e = React.createElement; | |
29 | |
30 // see https://github.com/lit/lit/tree/main/packages/labs/react | |
31 | |
32 class Main extends React.Component { | |
33 constructor(props) { | |
34 super(props); | |
35 this.state = { model: FlexLayout.Model.fromJson(config) }; | |
36 } | |
37 | |
38 factory = (node) => { | |
39 var component = node.getComponent(); | |
40 return e(component, null, ""); | |
41 }; | |
42 | |
43 render() { | |
44 return e(FlexLayout.Layout, { model: this.state.model, factory: this.factory }); | |
45 } | |
46 } | |
47 | |
48 const root = createRoot(document.getElementById("container")!); | |
49 root.render(React.createElement(Main)); |