"use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { signOut } from "next-auth/react"; import { LayoutDashboard, Users, FolderOpen, Tag, BookOpen, Settings, LogOut, Zap, FileText, MessageSquare, } from "lucide-react"; import ThemeToggle from "@/components/ThemeToggle"; import { cn } from "@/lib/utils"; const NAV_ITEMS = [ { href: "/admin", label: "Dashboard", icon: LayoutDashboard, exact: true }, { href: "/admin/conversazioni", label: "Conversazioni", icon: MessageSquare }, { href: "/admin/pipeline", label: "Pipeline", icon: Zap }, { href: "/admin/clients", label: "Clienti", icon: Users }, { href: "/admin/projects", label: "Progetti", icon: FolderOpen }, { href: "/admin/preventivi", label: "Preventivi", icon: FileText }, { href: "/admin/offers", label: "Offerte", icon: Tag }, { href: "/admin/catalog", label: "Catalogo", icon: BookOpen }, { href: "/admin/impostazioni", label: "Impostazioni", icon: Settings }, ]; export function AdminSidebar({ collapsed = false, unreadConversations = 0, }: { collapsed?: boolean; unreadConversations?: number; }) { const pathname = usePathname(); const isActive = (href: string, exact?: boolean) => exact ? pathname === href : pathname === href || pathname.startsWith(href + "/"); // Shared row layout: full width + gap + label when expanded, icon centered // (no gap, no padding) when collapsed so nothing pushes the icon off-center. const rowClass = collapsed ? "justify-center px-0" : "gap-3 px-3"; return ( ); }