// — the swarm UI's links menu: `@hive/shared`'s, fed the swarm's // service list from `GET /api/links` (the services behind the swarm's vhosts, // each with its glyph). A failed fetch leaves the list empty, and an empty // menu draws nothing: no button beats a broken one. import { useEffect, useState } from "preact/hooks"; import { LinksMenu as SharedLinksMenu, type MenuLink, } from "@hive/shared/links-menu.js"; import "@hive/shared/links-menu.css"; export function LinksMenu() { const [links, setLinks] = useState([]); useEffect(() => { fetch("/api/links") .then((r) => r.ok ? (r.json() as Promise) : Promise.reject(new Error(`http ${r.status}`)), ) .then(setLinks) .catch(() => setLinks([])); }, []); return ; }