'use client'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; import { LayoutDashboard, Package, Newspaper, Users, MessageSquare, Settings, UserCog, BookOpen, } from 'lucide-react'; import { cn } from '@/lib/utils'; import { useAdminStore } from '@/store/adminStore'; interface NavItem { href: string; label: string; icon: React.ComponentType<{ className?: string }>; /** 仅超级管理员可见 */ superAdminOnly?: boolean; } interface NavGroup { label: string; items: NavItem[]; } const NAV_GROUPS: NavGroup[] = [ { label: '概览', items: [ { href: '/admin/dashboard', label: '仪表盘', icon: LayoutDashboard }, ], }, { label: '内容管理', items: [ { href: '/admin/product', label: '产品管理', icon: Package }, { href: '/admin/news', label: '新闻管理', icon: Newspaper }, { href: '/admin/team', label: '团队管理', icon: Users }, { href: '/admin/message', label: '留言管理', icon: MessageSquare }, { href: '/admin/manual', label: '使用手册', icon: BookOpen }, ], }, { label: '系统', items: [ { href: '/admin/site-config', label: '网站配置', icon: Settings }, { href: '/admin/admin-user', label: '管理员账号', icon: UserCog, superAdminOnly: true, }, ], }, ]; export function AdminSidebar() { const pathname = usePathname(); const isSuperAdmin = useAdminStore((s) => s.admin?.role) === 'super_admin'; return ( ); }