import { useAuth } from "../../auth/AuthContext"; import { useRelayStatus } from "../../lib/useRelayStatus"; import { Badge } from "../ui/Badge"; import { Button } from "../ui/Button"; import { LogoutIcon } from "./icons"; function roleTone(role: string | undefined): "accent" | "ok" | "neutral" { if (role === "admin") return "accent"; if (role === "operator") return "ok"; return "neutral"; } export function Topbar() { const { user, logout } = useAuth(); const { live, checking } = useRelayStatus(); const relayClass = live ? "relay relay--live" : "relay relay--down"; const relayLabel = checking ? "probing" : live ? "live" : "offline"; return (
{user?.username}
{user?.role ?? "—"}
); }