import { useLocation } from "@tanstack/react-router"; import { Activity, Wifi, WifiOff } from "lucide-react"; import { useQuery } from "@tanstack/react-query"; import { apiClient } from "../lib/api"; import { ThemeToggle } from "./ui/theme-toggle"; import { Separator } from "./ui/separator"; import { SidebarTrigger } from "./ui/sidebar"; const navigation = [ { name: "Overview", to: "/" }, { name: "Transactions", to: "/transactions" }, { name: "Analytics", to: "/analytics" }, { name: "System", to: "/system" }, { name: "Settings", to: "/settings" }, ]; export function SiteHeader() { const location = useLocation(); const currentPage = navigation.find((item) => item.to === location.pathname)?.name || "Dashboard"; const { data: healthStatus, isLoading: healthLoading, isError: healthError, } = useQuery({ queryKey: ["health"], queryFn: apiClient.getHealth, refetchInterval: 30000, }); return (

{currentPage}

{/* Version display */}
{healthLoading ? ( v... ) : healthError || !healthStatus ? ( v? ) : ( v{healthStatus.version || "?"} )}
{/* Connection status */}
{healthLoading ? ( <> Checking... ) : healthError || healthStatus?.status !== "healthy" ? ( <> Disconnected ) : ( <> Connected )}
); }