"use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { BarChart3, CalendarDays, Crown, Droplet, FileClock, Hexagon, History, LayoutDashboard, Layers, ListTodo, type LucideIcon, MapPin, Package, Search, ShoppingBag, Upload, Users, Warehouse, Webhook, Wrench, Zap, } from "lucide-react"; import { cn } from "@/lib/utils"; import type { AuthUser } from "@/lib/auth/auth-context"; interface NavItem { label: string; href: string; icon: LucideIcon; } interface NavGroup { label: string | null; items: NavItem[]; } const NAV_GROUPS: NavGroup[] = [ { label: null, items: [ { label: "Dashboard", href: "/dashboard", icon: LayoutDashboard }, { label: "Suche", href: "/search", icon: Search }, ], }, { label: "Betrieb", items: [ { label: "Bienenstände", href: "/apiaries", icon: MapPin }, { label: "Völker", href: "/colonies", icon: Layers }, { label: "Königinnen", href: "/queens", icon: Crown }, ], }, { label: "Arbeit", items: [ { label: "Aufgaben", href: "/tasks", icon: ListTodo }, { label: "Kalender", href: "/calendar", icon: CalendarDays }, ], }, { label: "Ernte & Lager", items: [ { label: "Honigchargen", href: "/honey-batches", icon: Droplet }, { label: "Abfüllungen", href: "/bottling/new", icon: Package }, { label: "Produkte", href: "/products", icon: ShoppingBag }, { label: "Lager", href: "/storage", icon: Warehouse }, { label: "Inventar", href: "/equipment", icon: Wrench }, ], }, { label: "Auswertung", items: [{ label: "Statistik", href: "/statistics", icon: BarChart3 }], }, ]; const ADMIN_GROUP: NavGroup = { label: "Verwaltung", items: [ { label: "Benutzer", href: "/settings/users", icon: Users }, { label: "Audit-Log", href: "/settings/audit-log", icon: History }, { label: "Webhooks", href: "/settings/webhooks", icon: Webhook }, { label: "Automatisierungen", href: "/settings/automation-rules", icon: Zap }, { label: "Import", href: "/settings/import", icon: Upload }, ], }; function SidebarLink({ item, pathname }: { item: NavItem; pathname: string }) { const Icon = item.icon; const isActive = pathname.startsWith(item.href); return ( {item.label} ); } export function Sidebar({ user }: { user: AuthUser }) { const pathname = usePathname(); const groups = user.role === "ADMIN" ? [...NAV_GROUPS, ADMIN_GROUP] : NAV_GROUPS; return ( ); }