Checkpoint: Correction du bug où l'accordéon se refermait après avoir cliqué sur un sous-menu. Maintenant, la section parent reste ouverte automatiquement quand on navigue vers une page enfant.
This commit is contained in:
@@ -182,6 +182,19 @@ function DashboardLayoutContent({
|
||||
setOpenSection(prev => prev === label ? null : label);
|
||||
};
|
||||
|
||||
// Ouvrir automatiquement la section parent quand on navigue vers une page enfant
|
||||
useEffect(() => {
|
||||
for (const section of menuStructure) {
|
||||
if (section.children) {
|
||||
const hasActiveChild = section.children.some(child => child.path === location);
|
||||
if (hasActiveChild && openSection !== section.label) {
|
||||
setOpenSection(section.label);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}, [location]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isCollapsed) {
|
||||
setIsResizing(false);
|
||||
|
||||
Reference in New Issue
Block a user