"use client"; import { LayoutGrid, Camera, FileDown, Settings, Package, BarChart3, LogOut, User as UserIcon, Loader2, Bot, ChevronRight, ChevronLeft } from "lucide-react"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { cn } from "@/lib/utils"; import { useGridStore } from "@/features/grid/store/use-grid-store"; import { useEffect, useState } from "react"; import { useSession, signOut } from "next-auth/react"; const NAV_ITEMS = [ { icon: LayoutGrid, label: "Grille", href: "/grid" }, { icon: Camera, label: "Snapshots", href: "/snapshots" }, { icon: FileDown, label: "Exports", href: "/exports" }, { icon: BarChart3, label: "Score", href: "/score" }, { icon: Bot, label: "Aide IA", href: "/docs/ai-analysis" }, { icon: Settings, label: "Paramètres", href: "/settings", adminOnly: true }, ]; export function Sidebar() { const pathname = usePathname(); const { data: session } = useSession(); const activeGridQuery = useGridStore((s) => s.activeGridQuery); const [isMounted, setIsMounted] = useState(false); const [isExpanded, setIsExpanded] = useState(false); useEffect(() => { setIsMounted(true); // Load expanded state from local storage const stored = localStorage.getItem("sidebar_expanded"); if (stored === "true") setIsExpanded(true); }, []); const toggleSidebar = () => { const next = !isExpanded; setIsExpanded(next); localStorage.setItem("sidebar_expanded", String(next)); }; const userRole = (session?.user as any)?.role; const filteredItems = NAV_ITEMS.filter(item => !item.adminOnly || userRole === "admin"); return ( ); }