"use client"; import { usePathname } from "next/navigation"; import { useTheme } from "next-themes"; import { Moon, Sun } from "lucide-react"; import { navItems } from "@/lib/navigation"; import { useAmbient } from "@/components/ambient/ambient-context"; import { ConnectionStatus } from "./status-dot"; import { useEffect, useState } from "react"; import { cn } from "@/lib/utils"; function useActiveLabel() { const pathname = usePathname(); const item = [...navItems] .sort((a, b) => b.matchPrefix.length - a.matchPrefix.length) .find((i) => pathname.startsWith(i.matchPrefix)); return item?.label ?? "Console"; } export function TopBar() { const label = useActiveLabel(); const { state } = useAmbient(); const { theme, setTheme } = useTheme(); const [mounted, setMounted] = useState(false); useEffect(() => setMounted(true), []); const signalTone = state.tone === "vermilion" ? "text-vermilion" : state.tone === "amber" ? "text-amber" : "text-signal"; return (
GMW

{label}

{state.label ?? "nominal"}
); }