import { Activity, Database, HardDrive, LayoutDashboard, ListChecks, LogOut, MessagesSquare, Moon, ScrollText, Settings, ShieldCheck, Sun, Users, } from 'lucide-react' import { NavLink, Navigate, Outlet, useNavigate } from 'react-router-dom' import { useSession } from '@/app/session' import { useTheme } from '@/app/theme' import { Badge, Button, Loading } from '@/shared/ui' const NAV_ITEMS = [ { to: '/', label: '系统状态', icon: LayoutDashboard, end: true }, { to: '/users', label: '用户', icon: Users }, { to: '/spaces', label: 'Space', icon: Database }, { to: '/chat', label: '聊天记录', icon: MessagesSquare }, { to: '/storage', label: '存储', icon: HardDrive }, { to: '/queues', label: '队列', icon: Activity }, { to: '/tasks', label: '任务', icon: ListChecks }, { to: '/logs', label: '日志', icon: ScrollText }, { to: '/admins', label: '管理员', icon: ShieldCheck }, { to: '/system', label: '系统配置', icon: Settings }, ] function roleLabel(role: string): string { switch (role) { case 'super_admin': return '超级管理员' case 'operator': return '运维' default: return '只读' } } export function AdminShell() { const { me, loading, logout } = useSession() const { dark, toggle } = useTheme() const navigate = useNavigate() if (loading) { return } if (!me) { return } if (me.must_change_password) { return } return (
{me.display_name} {roleLabel(me.role)}
) }