import { Suspense, useEffect, useState } from "react"; import { NavLink, Routes, Route, Navigate, useLocation } from "react-router-dom"; import { routes, navGroups, defaultPath } from "../routes"; import { gatewayOnline } from "../api"; // 控制台外壳:导航与内容均由路由注册表派生(动态路由)。 export function AppShell() { const [online, setOnline] = useState(false); const loc = useLocation(); const current = routes.find((r) => r.path === loc.pathname); useEffect(() => { const ping = () => gatewayOnline().then(setOnline); ping(); const id = setInterval(ping, 4000); return () => clearInterval(id); }, []); return (

{current?.label ?? ""}

加载中…
}> {routes.map((r) => ( ))} } /> ); }