import { Link } from '@tanstack/react-router'; import { useTranslation } from 'react-i18next'; import { LayoutDashboard, Users, FileText, Settings, X } from 'lucide-react'; import type { LucideIcon } from 'lucide-react'; import { cn } from '@/lib/utils'; import { useAuth } from '@/contexts/auth-context'; import { LanguageSwitcher } from '@/i18n/LanguageSwitcher'; import { ThemeToggle } from './ThemeToggle'; import { UserMenu } from './UserMenu'; type Role = 'Owner' | 'Administrator' | 'User'; interface NavItem { to: string; labelKey: string; icon: LucideIcon; testId: string; roles?: Role[]; } const NAV_ITEMS: NavItem[] = [ { to: '/dashboard', labelKey: 'nav.dashboard', icon: LayoutDashboard, testId: 'nav-dashboard' }, { to: '/users', labelKey: 'nav.users', icon: Users, testId: 'nav-users', roles: ['Owner', 'Administrator'] }, { to: '/settings', labelKey: 'nav.settings', icon: Settings, testId: 'nav-settings', roles: ['Owner'] }, { to: '/cms', labelKey: 'nav.cms', icon: FileText, testId: 'nav-cms', roles: ['Owner'] }, ]; interface SidebarProps { onClose?: () => void; } export function Sidebar({ onClose }: SidebarProps = {}) { const { t } = useTranslation(); const { user } = useAuth(); const role = user?.role as Role | undefined; const visibleItems = NAV_ITEMS.filter( (item) => !item.roles || (role && item.roles.includes(role)) ); return ( ); }