import { IconAlarm, IconBarChartHStroked, IconBox, IconChevronLeft, IconHelpCircle, IconHome, IconMapPin, IconSearch, IconSetting, IconUser, IconExit } from '@douyinfe/semi-icons'; import { useEffect, useState } from 'react'; import { NavLink, Outlet, useLocation } from 'react-router-dom'; import { usePlatformSession } from '../auth/AuthGate'; import { preloadRoute, scheduleIdleRoutePreloads } from '../routing/routeModules'; const navigation = [ { to: '/monitor', label: '全局监控', icon: IconHome }, { to: '/vehicles', label: '车辆查询', icon: IconSearch }, { to: '/tracks', label: '轨迹回放', icon: IconMapPin }, { to: '/history', label: '历史数据', icon: IconBarChartHStroked }, { to: '/statistics', label: '里程查询', icon: IconBarChartHStroked }, { to: '/alerts', label: '告警中心', icon: IconAlarm }, { to: '/access', label: '接入管理', icon: IconBox } ]; const pageNames: Record = { monitor: '全局监控', vehicles: '车辆查询', tracks: '轨迹回放', history: '历史数据', statistics: '里程查询', alerts: '告警中心', access: '接入管理', operations: '运维质量' }; export function AppShell() { const location = useLocation(); const [initialPathname] = useState(() => location.pathname); const section = location.pathname.split('/')[1] || 'monitor'; const { session, logout } = usePlatformSession(); const roleLabel = { viewer: '只读', operator: '处置员', admin: '管理员' }[session.role]; useEffect(() => scheduleIdleRoutePreloads({ activePathname: initialPathname }), [initialPathname]); return (

{pageNames[section] ?? '车辆数据中台'}

{session.name}{roleLabel}
); } function Sidebar() { const [collapsed, setCollapsed] = useState(false); const warmRoute = (path: string) => { void preloadRoute(path); }; return ( ); }