import { NavLink, Outlet, useNavigate } from 'react-router-dom' import { LayoutDashboard, Users, PawPrint, MessageSquare, MessagesSquare, FileText, ClipboardList, ListChecks, Dna, Sparkles, MessageCircle, Crown, LogOut } from 'lucide-react' import { api, clearToken } from '@/lib/api' import { cn } from '@/lib/utils' import { Button } from '@/components/ui/button' const nav = [ { to: '/', label: '概览', icon: LayoutDashboard, end: true }, { to: '/users', label: '用户管理', icon: Users }, { to: '/pets', label: '宠物管理', icon: PawPrint }, { to: '/posts', label: '帖子审核', icon: MessageSquare }, { to: '/comments', label: '评论管理', icon: MessagesSquare }, { to: '/articles', label: '文章管理', icon: FileText }, { to: '/care-templates', label: '养护模板', icon: ClipboardList }, { to: '/record-types', label: '记录事项', icon: ListChecks }, { to: '/breeds', label: '品种管理', icon: Dna }, { to: '/community-bot', label: '社区运营', icon: Sparkles }, { to: '/feedback', label: '意见反馈', icon: MessageCircle }, { to: '/members', label: '会员管理', icon: Crown }, ] export default function Layout() { const navigate = useNavigate() function logout() { // 服务端作废刷新令牌,成不成都要本地清掉 api.logout().catch(() => {}) clearToken() navigate('/login') } return (
) }