import { useLocation } from "@tanstack/react-router"; import { Menu, Activity, Wifi, WifiOff } from "lucide-react"; import { useQuery } from "@tanstack/react-query"; import { apiClient } from "../lib/api"; const navigation = [ { name: "Overview", to: "/" }, { name: "Transactions", to: "/transactions" }, { name: "Analytics", to: "/analytics" }, { name: "Notifications", to: "/notifications" }, ]; interface HeaderProps { setSidebarOpen: (open: boolean) => void; } export default function Header({ setSidebarOpen }: HeaderProps) { 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}

{healthLoading ? ( <> Checking... ) : healthError || healthStatus?.status !== "healthy" ? ( <> Disconnected ) : ( <> Connected )}
); }