import { useTranslation } from 'react-i18next'; import { NavLink } from 'react-router-dom'; import { useAuth } from '../context/AuthContext'; import { useConversationsContext } from '../context/ConversationsContext'; import { useFriendshipsContext } from '../context/FriendshipsContext'; import { CallBar } from './CallUI'; import { ChatBubbleIcon, GearIcon, LogoLockup, ShieldIcon, SignOutIcon, UsersIcon, } from './icons'; import { UserBar } from './UserBar'; interface NavItem { to: string; labelKey: string; icon: (props: React.SVGProps) => React.JSX.Element; } const BASE_NAV_ITEMS: NavItem[] = [ { to: '/chats', labelKey: 'app:nav.chats', icon: ChatBubbleIcon }, { to: '/friends', labelKey: 'app:nav.friends', icon: UsersIcon }, { to: '/settings', labelKey: 'app:nav.settings', icon: GearIcon }, ]; const ADMIN_NAV_ITEM: NavItem = { to: '/admin', labelKey: 'app:nav.admin', icon: ShieldIcon, }; export function Sidebar() { const { t } = useTranslation(['app']); const { signOut, profile } = useAuth(); const { incomingCount } = useFriendshipsContext(); const { totalUnread } = useConversationsContext(); const navItems = profile?.isAdmin ? [...BASE_NAV_ITEMS, ADMIN_NAV_ITEM] : BASE_NAV_ITEMS; return ( ); } function NavBadge({ count }: { count: number }) { const display = count > 99 ? '99+' : String(count); return ( ); }