"use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { LayoutDashboard, Cpu, Package, ClipboardList, Factory, History, Users, Truck, Building2, ClipboardCheck, Settings, LogOut, } from "lucide-react"; import { cn } from "@/lib/utils"; import { useAuth } from "@/contexts/auth-context"; import { Button } from "@/components/ui/button"; const navItems = [ { href: "/", label: "Dashboard", icon: LayoutDashboard, section: "dashboard" }, { href: "/customers", label: "Customers & Orders", icon: Users, section: "customers" }, { href: "/suppliers", label: "Suppliers", icon: Building2, section: "suppliers" }, { href: "/products", label: "Products", icon: Package, section: "products" }, { href: "/components", label: "Components", icon: Cpu, section: "components" }, { href: "/bom", label: "Bill of Materials", icon: ClipboardList, section: "products" }, { href: "/stock-history", label: "Purchase History", icon: History, section: "stock-history" }, { href: "/production", label: "Production Planning", icon: Factory, section: "production" }, { href: "/logistics", label: "Logistics", icon: Truck, section: "logistics" }, { href: "/stock-take", label: "Stock Take", icon: ClipboardCheck, section: "stock-take" }, ]; export function AppSidebar() { const pathname = usePathname(); const { user, logout, canAccessSection } = useAuth(); // Filter nav items based on user permissions const visibleNavItems = navItems.filter((item) => canAccessSection(item.section)); return ( ); }