import { useUIStore, type ViewMode } from '../stores/uiStore'; import { useMailStore } from '../stores/mailStore'; import { useContactStore } from '../stores/contactStore'; import { useAuthStore } from '../stores/authStore'; import { InboxIcon, SentIcon, ContactsIcon, ComposeIcon, UsersIcon, LogoutIcon } from './icons'; import { ConnectionIndicator } from './ConnectionIndicator'; const navItems: { short: string; title: string; mode: ViewMode; Icon: (p: { className?: string }) => JSX.Element; adminOnly?: boolean; }[] = [ { short: '收件', title: '收件箱', mode: 'inbox', Icon: InboxIcon }, { short: '发件', title: '发件箱', mode: 'sent', Icon: SentIcon }, { short: '联系', title: '联系人', mode: 'contacts', Icon: ContactsIcon }, { short: '用户', title: '用户管理', mode: 'admin', Icon: UsersIcon, adminOnly: true } ]; export default function Sidebar() { const viewMode = useUIStore(s => s.viewMode); const setViewMode = useUIStore(s => s.setViewMode); const composing = useUIStore(s => s.composing); const startCompose = useUIStore(s => s.startCompose); const inbox = useMailStore(s => s.inbox); const unread = inbox.filter(m => m.status === 'unread').length; const contacts = useContactStore(s => s.contacts); const user = useAuthStore(s => s.user); const logout = useAuthStore(s => s.logout); const isAdmin = user?.role === 'admin'; return (