import type { ReactNode } from "react"; import { Link, useLocation } from "wouter"; import { Activity, ClipboardList, LayoutDashboard, Settings, Users } from "lucide-react"; import { useLive } from "../state"; import { Mark } from "./Mark"; import { ThemeToggle } from "./ThemeSwitch"; import { UserMenu } from "./UserMenu"; import { Legal } from "./Legal"; // Account is reached through the user menu, so it is not a nav item. const groups = [ { label: "Overview", items: [ { href: "/", label: "Dashboard", icon: LayoutDashboard }, { href: "/peers", label: "Peers", icon: Activity }, ], }, { label: "Administration", items: [ { href: "/settings", label: "Settings", icon: Settings }, { href: "/users", label: "Users", icon: Users }, { href: "/audit", label: "Audit log", icon: ClipboardList }, ], }, ]; const all = groups.flatMap((g) => g.items); function isActive(href: string, location: string) { return href === "/" ? location === "/" : location.startsWith(href); } function LivePill() { const { connected } = useLive(); return ( {connected ? "Live" : "Reconnecting"} ); } export function Layout({ children }: { children: ReactNode }) { const [location] = useLocation(); return (