From 8b74f8e0ead180d905832267b53d35b0b4b5f957 Mon Sep 17 00:00:00 2001 From: Manus Date: Fri, 13 Feb 2026 04:43:05 -0500 Subject: [PATCH] =?UTF-8?q?Checkpoint:=20Am=C3=A9lioration=20du=20menu=20a?= =?UTF-8?q?ccord=C3=A9on=20avec=20comportement=20exclusif=20(un=20seul=20o?= =?UTF-8?q?uvert=20=C3=A0=20la=20fois)=20et=20design=20moderne=20color?= =?UTF-8?q?=C3=A9=20avec=20d=C3=A9grad=C3=A9s,=20ic=C3=B4nes=20agrandies,?= =?UTF-8?q?=20et=20animations=20fluides?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/components/DashboardLayout.tsx | 90 +++++++++++++---------- todo.md | 12 ++- 2 files changed, 63 insertions(+), 39 deletions(-) diff --git a/client/src/components/DashboardLayout.tsx b/client/src/components/DashboardLayout.tsx index 97f0d65..1f753eb 100644 --- a/client/src/components/DashboardLayout.tsx +++ b/client/src/components/DashboardLayout.tsx @@ -37,6 +37,7 @@ type MenuItem = { path?: string; adminOnly?: boolean; children?: MenuItem[]; + color?: string; // Couleur de la section }; const menuStructure: MenuItem[] = [ @@ -44,10 +45,12 @@ const menuStructure: MenuItem[] = [ icon: LayoutDashboard, label: "Tableau de bord", path: "/dashboard", + color: "from-blue-500 to-cyan-500", }, { icon: Receipt, label: "Facturation", + color: "from-purple-500 to-pink-500", children: [ { icon: Upload, label: "Import", path: "/upload" }, { icon: FileText, label: "Factures", path: "/invoices" }, @@ -57,6 +60,7 @@ const menuStructure: MenuItem[] = [ { icon: Cog, label: "Configuration", + color: "from-orange-500 to-amber-500", children: [ { icon: Settings, label: "Paramètres", path: "/settings" }, { icon: Download, label: "Paramètres d'import", path: "/import-settings" }, @@ -68,6 +72,7 @@ const menuStructure: MenuItem[] = [ { icon: ClipboardList, label: "Traçabilité", + color: "from-green-500 to-emerald-500", children: [ { icon: History, label: "Historiques", path: "/history" }, ], @@ -156,8 +161,8 @@ function DashboardLayoutContent({ const sidebarRef = useRef(null); const isMobile = useIsMobile(); - // État pour les sections ouvertes (Tableau de bord ouvert par défaut) - const [openSections, setOpenSections] = useState>(new Set(["Tableau de bord"])); + // État pour la section ouverte (une seule à la fois, Tableau de bord par défaut) + const [openSection, setOpenSection] = useState("Tableau de bord"); // Trouver le label actif pour le header mobile const findActiveLabel = (): string => { @@ -172,15 +177,9 @@ function DashboardLayoutContent({ }; const toggleSection = (label: string) => { - setOpenSections(prev => { - const newSet = new Set(prev); - if (newSet.has(label)) { - newSet.delete(label); - } else { - newSet.add(label); - } - return newSet; - }); + // Si on clique sur la section déjà ouverte, on la ferme + // Sinon, on ouvre la nouvelle section (et ferme automatiquement l'ancienne) + setOpenSection(prev => prev === label ? null : label); }; useEffect(() => { @@ -227,22 +226,28 @@ function DashboardLayoutContent({ if (!item.children) { const isActive = location === item.path; return ( - + item.path && setLocation(item.path)} tooltip={item.label} - className="h-10 transition-all font-normal" + className={`h-12 transition-all font-medium rounded-xl ${ + isActive + ? `bg-gradient-to-r ${item.color} text-white shadow-lg` + : "hover:bg-accent/50" + }`} > - - {item.label} +
+ +
+ {item.label}
); } // Item avec enfants (accordéon) - const isOpen = openSections.has(item.label); + const isOpen = openSection === item.label; const hasActiveChild = item.children.some(child => child.path === location); return ( @@ -250,24 +255,29 @@ function DashboardLayoutContent({ key={item.label} open={isOpen} onOpenChange={() => toggleSection(item.label)} - className="group/collapsible" + className="group/collapsible mb-2" > - - {item.label} +
+ +
+ {item.label}
- - + + {item.children .filter(child => !child.adminOnly || user?.role === "admin") .map(child => { @@ -277,9 +287,13 @@ function DashboardLayoutContent({ child.path && setLocation(child.path)} - className="h-9" + className={`h-10 rounded-lg transition-all ${ + isActive + ? "bg-accent text-accent-foreground font-medium shadow-sm" + : "hover:bg-accent/50" + }`} > - + {child.label} @@ -300,18 +314,18 @@ function DashboardLayoutContent({ className="border-r-0" disableTransition={isResizing} > - +
{!isCollapsed ? (
- + Navigation
@@ -319,23 +333,23 @@ function DashboardLayoutContent({
- - + + {menuStructure.map(renderMenuItem)} - + -