import React, { useEffect, useState } from 'react'; import { NavLink, Outlet, useLocation } from 'react-router-dom'; import { LayoutDashboard, Settings, Activity, History } from 'lucide-react'; const MainLayout: React.FC = () => { const [isServerOnline, setIsServerOnline] = useState(false); const location = useLocation(); useEffect(() => { // Basic ping to check if our API is running fetch('/api/health') .then((res) => { if (res.ok) setIsServerOnline(true); }) .catch(() => setIsServerOnline(false)); // Optional: add a polling interval const interval = setInterval(() => { fetch('/api/health') .then((res) => setIsServerOnline(res.ok)) .catch(() => setIsServerOnline(false)); }, 10000); return () => clearInterval(interval); }, []); const getPageTitle = (pathname: string) => { switch (pathname) { case '/': return 'Dashboard Overview'; case '/settings': return 'Definitions & Policies'; case '/history': return 'Run History'; default: return 'AI Ops'; } }; return (

{getPageTitle(location.pathname)}

Agent Ready
); }; export default MainLayout;