"use client"; import { useState } from "react"; import Link from "next/link"; import { usePathname, useRouter } from "next/navigation"; import { signOut } from "next-auth/react"; import { cn } from "@/lib/utils"; import { Button } from "@/components/ui/button"; import { LayoutDashboard, Wallet, FolderTree, Tags, BarChart3, Upload, ChevronLeft, ChevronRight, Settings, Wand2, LogOut, } from "lucide-react"; import { toast } from "sonner"; const navItems = [ { href: "/", label: "Tableau de bord", icon: LayoutDashboard }, { href: "/accounts", label: "Comptes", icon: Wallet }, { href: "/folders", label: "Organisation", icon: FolderTree }, { href: "/transactions", label: "Transactions", icon: Upload }, { href: "/categories", label: "Catégories", icon: Tags }, { href: "/rules", label: "Règles", icon: Wand2 }, { href: "/statistics", label: "Statistiques", icon: BarChart3 }, ]; export function Sidebar() { const pathname = usePathname(); const router = useRouter(); const [collapsed, setCollapsed] = useState(false); const handleSignOut = async () => { try { await signOut({ redirect: false }); toast.success("Déconnexion réussie"); router.push("/login"); router.refresh(); } catch (error) { console.error("Error signing out:", error); toast.error("Erreur lors de la déconnexion"); } }; return ( ); }