diff --git a/src/features/admin/components/AdminHeader.js b/src/features/admin/components/AdminHeader.js index 8fdb2a5..378a673 100644 --- a/src/features/admin/components/AdminHeader.js +++ b/src/features/admin/components/AdminHeader.js @@ -3,11 +3,12 @@ import { Fragment } from 'react'; import { Menu, MenuButton, MenuItem, MenuItems, Transition } from '@headlessui/react'; import { ChevronDownIcon } from '@zen/core/shared/icons'; -import { useRouter } from 'next/navigation'; +import { useRouter, usePathname } from 'next/navigation'; import { useTheme, getThemeIcon } from '@zen/core/themes'; -const AdminHeader = ({ isMobileMenuOpen, setIsMobileMenuOpen, user, onLogout, appName = 'ZEN' }) => { +const AdminHeader = ({ isMobileMenuOpen, setIsMobileMenuOpen, user, onLogout, appName = 'ZEN', navigationSections = [] }) => { const router = useRouter(); + const pathname = usePathname(); const getImageUrl = (imageKey) => { if (!imageKey) return null; @@ -47,14 +48,28 @@ const AdminHeader = ({ isMobileMenuOpen, setIsMobileMenuOpen, user, onLogout, ap const ThemeIcon = getThemeIcon(theme, systemIsDark); const themeLabel = theme === 'light' ? 'Mode clair' : theme === 'dark' ? 'Mode sombre' : 'Thème système'; + const currentPageName = (() => { + for (const section of navigationSections) { + for (const item of section.items) { + if (pathname === item.href || pathname.startsWith(item.href + '/')) { + return item.name; + } + } + if (section.items.length === 1 && (pathname === section.items[0].href || pathname.startsWith(section.items[0].href + '/'))) { + return section.title; + } + } + return null; + })(); + const quickLinks = []; const imageUrl = getImageUrl(user?.image); const userInitials = getUserInitials(user?.name); return (
-
- {/* Left section — Mobile menu button + Logo */} +
+ {/* Left section — Mobile menu button + Logo / Desktop breadcrumb */}
+ {/* Desktop breadcrumb */} + {currentPageName && ( +
+ {appName} + + + + {currentPageName} +
+ )} + {/* Right section — Quick links + Profile */}