import { NavLink } from 'react-router-dom'
import { useAuth } from '@/context/AuthContext'
import { cn } from '@/lib/utils'
import { Separator } from '@/components/ui/separator'
import {
LayoutDashboard,
FolderOpen,
Upload,
FileEdit,
ClipboardCheck,
FileBarChart,
Users,
Mail,
History,
} from 'lucide-react'
interface NavItem {
label: string
to: string
icon: React.ComponentType<{ className?: string }>
adminOnly?: boolean
mitarbeiterOnly?: boolean
}
const mainNavItems: NavItem[] = [
{ label: 'Dashboard', to: '/dashboard', icon: LayoutDashboard },
{ label: 'Faelle', to: '/cases', icon: FolderOpen },
{ label: 'Import', to: '/import', icon: Upload, adminOnly: true },
{ label: 'ICD-Eingabe', to: '/icd', icon: FileEdit, mitarbeiterOnly: true },
{ label: 'Coding', to: '/coding', icon: ClipboardCheck, adminOnly: true },
{ label: 'Berichte', to: '/reports', icon: FileBarChart },
]
const adminNavItems: NavItem[] = [
{ label: 'Benutzer', to: '/admin/users', icon: Users },
{ label: 'Einladungen', to: '/admin/invitations', icon: Mail },
{ label: 'Audit-Log', to: '/admin/audit', icon: History },
]
function NavItemLink({ item }: { item: NavItem }) {
const Icon = item.icon
return (
cn(
'flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors',
isActive
? 'bg-primary text-primary-foreground'
: 'text-muted-foreground hover:bg-accent hover:text-accent-foreground'
)
}
>
{item.label}
)
}
export function Sidebar({ className }: { className?: string }) {
const { user, isAdmin } = useAuth()
const visibleMainItems = mainNavItems.filter((item) => {
if (item.adminOnly && !isAdmin) return false
if (item.mitarbeiterOnly && user?.role !== 'dak_mitarbeiter') return false
return true
})
return (
)
}