From ddcaba382e6573f4a628a691bc0f20226a954fd7 Mon Sep 17 00:00:00 2001 From: N3WT DE COMPET Date: Sun, 15 Feb 2026 18:02:57 +0100 Subject: [PATCH] feat: Gestion de la sidebar [N3WTS-8] --- Front-End/src/app/[locale]/admin/layout.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Front-End/src/app/[locale]/admin/layout.js b/Front-End/src/app/[locale]/admin/layout.js index 9c88c27..72d8819 100644 --- a/Front-End/src/app/[locale]/admin/layout.js +++ b/Front-End/src/app/[locale]/admin/layout.js @@ -35,7 +35,7 @@ import { useEstablishment } from '@/context/EstablishmentContext'; export default function Layout({ children }) { const t = useTranslations('sidebar'); const [isSidebarOpen, setIsSidebarOpen] = useState(false); - const { profileRole, establishments, user, clearContext } = + const { profileRole, establishments, clearContext } = useEstablishment(); const sidebarItems = { @@ -112,6 +112,15 @@ export default function Layout({ children }) { setIsSidebarOpen(false); }, [pathname]); + // Filtrage dynamique des items de la sidebar selon le rĂ´le + let sidebarItemsToDisplay = Object.values(sidebarItems); + if (profileRole === 0) { + // Si pas admin, on retire "directory" et "settings" + sidebarItemsToDisplay = sidebarItemsToDisplay.filter( + (item) => item.id !== 'directory' && item.id !== 'settings' + ); + } + return ( {/* Sidebar */} @@ -123,7 +132,7 @@ export default function Layout({ children }) {