import { useEffect, useState } from "react"; import { NavLink, Outlet, useLocation, useNavigate } from "react-router-dom"; import { BarChart3, FileWarning, LayoutGrid, ListChecks, Moon, ScanLine, Sun, } from "lucide-react"; // The NETRA "eye" mark from the deck. function EyeMark() { return ( ); } import { getHealth } from "../api.js"; import { toggleTheme, useTheme } from "../hooks/useTheme.js"; const NAV = [ { to: "/", label: "Overview", icon: LayoutGrid, end: true }, { to: "/analyze", label: "Analyze", icon: ScanLine }, { to: "/violations", label: "Records", icon: ListChecks }, { to: "/challans", label: "Challans", icon: FileWarning }, { to: "/analytics", label: "Analytics", icon: BarChart3 }, ]; const TODAY = new Date().toLocaleDateString("en-IN", { weekday: "long", day: "numeric", month: "long", }); export default function Layout() { const [online, setOnline] = useState(null); const navigate = useNavigate(); const { pathname } = useLocation(); const theme = useTheme(); useEffect(() => { const ping = () => getHealth().then(() => setOnline(true)).catch(() => setOnline(false)); ping(); const id = setInterval(ping, 15000); return () => clearInterval(id); }, []); return (