comparison web/panels.ts @ 2408:7e7874fed2e3

buttons to add panels to the layout
author drewp@bigasterisk.com
date Sat, 18 May 2024 21:02:32 -0700
parents
children ae4b90efb55a
comparison
equal deleted inserted replaced
2404:9cbc93f80b05 2408:7e7874fed2e3
1 export { Light9AscoltamiUi } from "./ascoltami/Light9AscoltamiUi";
2 export { Light9CollectorUi } from "./collector/Light9CollectorUi";
3 export { Light9EffectListing } from "./effects/Light9EffectListing";
4 export { Light9FadeUi } from "./fade/Light9FadeUi";
5 export { Light9DeviceSettings } from "./live/Light9DeviceSettings";
6
7 const panels: Map<string, Array<string>> = new Map([
8 ["light9-ascoltami-ui", ["ascoltami", "ascoltami"]],
9 ["light9-collector-ui", ["collector", "collector"]],
10 ["light9-device-settings", ["device-settings", "live"]],
11 ["light9-effect-listing", ["effect-listing" , "effectListing"]],
12 ["light9-fade-ui", ["fade", "fade"]],
13 ]);
14
15 export function panelElementNames(): string[] {
16 return Array.from(panels.keys());
17 }
18
19 export function panelUrl(elem: string): string {
20 const row = panels.get(elem);
21 if (!row) throw new Error("No panel: " + elem);
22 return "/" + row[1] + "/";
23 }
24
25 export function panelDisplayName(elem: string): string {
26 const row = panels.get(elem);
27 if (!row) throw new Error("No panel: " + elem);
28 return row[0];
29 }