Fork Horse repository, listed by its owner. Publisher snapshot.
packages/forkhorse-dashboard/src/main.ts
Snapshot at 34e3175
1import { followSystemTheme } from "./theme.ts";
2import { mountDashboard } from "./dashboard.ts";
3import { createHttpTransport } from "./transport.ts";
4import type { Brand, ProjectOption } from "./contracts.ts";
5import "./styles.css";
6
7declare const __DASHBOARD_BRAND__: Brand;
8
9// FH-012 may embed an inert JSON config block containing project IDs/labels only.
10const configElement = document.getElementById("dashboard-config");
11const config = configElement
12 ? (JSON.parse(configElement.textContent ?? "{}") as { projects?: ProjectOption[] })
13 : {};
14const root = document.getElementById("dashboard")!;
15document.title = `${__DASHBOARD_BRAND__.name} 路 Projects`;
16mountDashboard(root, {
17 brand: __DASHBOARD_BRAND__,
18 projects: config.projects,
19 initialProject: new URLSearchParams(location.search).get("project") ?? undefined,
20 transport: createHttpTransport({ origin: location.origin }),
21});
22
23const stopTheme = followSystemTheme();
24window.addEventListener("pagehide", stopTheme, { once: true });
25