// Root shell component. `/` is now the real hive-roster overview page — // fetches swarm-controller's `GET /api/hives` and renders it through the // shared primitives. Status starts as a static "configured" chip; grows // into a real online/stale/offline tone once a status rollup exists // server-side — same component, richer data later, no rebuild. import { useEffect, useState } from 'preact/hooks'; import { Route, Switch } from 'wouter-preact'; import { Shell } from './shell/Shell.js'; import { Panel } from './ui/panel/Panel.js'; import { StatusChip } from './ui/status-chip/StatusChip.js'; import { Table, type TableColumn } from './ui/table/Table.js'; interface Hive { name: string; domain: string; } const COLUMNS: TableColumn[] = [ { key: 'name', header: 'name', render: (h) => h.name }, { key: 'domain', header: 'domain', render: (h) => ( {h.domain} ), }, // Static "configured" tone until a swarm-wide status rollup exists — // there is no data source for online/stale/offline yet, and a chip // that always renders "positive" would misreport a genuinely offline // hive. See StatusChip's own doc comment for the same reasoning. { key: 'status', header: 'status', render: () => }, ]; function Home() { const [hives, setHives] = useState(null); const [error, setError] = useState(null); useEffect(() => { fetch('/api/hives') .then((r) => { if (!r.ok) throw new Error(`http ${r.status}`); return r.json() as Promise; }) .then(setHives) .catch((e: unknown) => setError(String(e))); }, []); return ( {error ?

failed to load the hive roster: {error}

: null} {!error && hives === null ?

loading…

: null} {hives ? h.name} /> : null} ); } function NotFound() { return (

no route here.

); } export function App() { return ( ); }