diff --git a/src/features/admin/components/AdminHeader.js b/src/features/admin/components/AdminHeader.js
index 0ec64c5..7691428 100644
--- a/src/features/admin/components/AdminHeader.js
+++ b/src/features/admin/components/AdminHeader.js
@@ -1,181 +1,29 @@
'use client';
-import { Fragment } from 'react';
-import { Menu, MenuButton, MenuItem, MenuItems, Transition } from '@headlessui/react';
-import { ChevronDownIcon, User03Icon } from '@zen/core/shared/icons';
-import { UserAvatar } from '@zen/core/shared/components';
-import { useRouter, usePathname } from 'next/navigation';
-import { useTheme, getThemeIcon } from '@zen/core/themes';
+import { useRouter } from 'next/navigation';
+import { Button } from '@zen/core/shared/components';
-const AdminHeader = ({ isMobileMenuOpen, setIsMobileMenuOpen, user, onLogout, appName = 'ZEN', navigationSections = [] }) => {
- const router = useRouter();
- const pathname = usePathname();
+const AdminHeader = ({ title, description, backHref, backLabel = '← Retour', action }) => {
+ const router = useRouter();
- const handleLogout = async () => {
- try {
- if (onLogout) {
- const result = await onLogout();
- if (result && result.success) {
- router.push('/auth/login');
- } else {
- console.error('Logout failed:', result?.error);
- router.push('/auth/login');
- }
- } else {
- router.push('/auth/login');
- }
- } catch (error) {
- console.error('Logout error:', error);
- router.push('/auth/login');
- }
- };
-
- const { theme, toggle, systemIsDark } = useTheme();
- 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 = [];
-
- return (
-
- );
+ return (
+
+
+ {backHref && (
+
+ )}
+
+
{title}
+ {description && (
+
{description}
+ )}
+
+
+ {action}
+
+ );
};
export default AdminHeader;
diff --git a/src/features/admin/components/AdminShell.js b/src/features/admin/components/AdminShell.js
index c29d107..2684dc4 100644
--- a/src/features/admin/components/AdminShell.js
+++ b/src/features/admin/components/AdminShell.js
@@ -2,7 +2,7 @@
import { useState } from 'react';
import AdminSidebar from './AdminSidebar.js';
-import AdminHeader from './AdminHeader.js';
+import AdminTop from './AdminTop.js';
export default function AdminShell({ children, user, onLogout, appName, navigationSections }) {
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
@@ -16,7 +16,7 @@ export default function AdminShell({ children, user, onLogout, appName, navigati
navigationSections={navigationSections}
/>
-
{
+ const router = useRouter();
+ const pathname = usePathname();
+
+ const handleLogout = async () => {
+ try {
+ if (onLogout) {
+ const result = await onLogout();
+ if (result && result.success) {
+ router.push('/auth/login');
+ } else {
+ console.error('Logout failed:', result?.error);
+ router.push('/auth/login');
+ }
+ } else {
+ router.push('/auth/login');
+ }
+ } catch (error) {
+ console.error('Logout error:', error);
+ router.push('/auth/login');
+ }
+ };
+
+ const { theme, toggle, systemIsDark } = useTheme();
+ 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 = [];
+
+ return (
+
+ );
+};
+
+export default AdminTop;
diff --git a/src/features/admin/components/index.js b/src/features/admin/components/index.js
index 47b9170..8d4bd38 100644
--- a/src/features/admin/components/index.js
+++ b/src/features/admin/components/index.js
@@ -2,5 +2,6 @@
export { default as AdminShell } from './AdminShell.js';
export { default as AdminSidebar } from './AdminSidebar.js';
+export { default as AdminTop } from './AdminTop.js';
export { default as AdminHeader } from './AdminHeader.js';
export { default as ThemeToggle } from './ThemeToggle.js';
diff --git a/src/features/admin/pages/DashboardPage.client.js b/src/features/admin/pages/DashboardPage.client.js
index 9ff1ec4..0014e7d 100644
--- a/src/features/admin/pages/DashboardPage.client.js
+++ b/src/features/admin/pages/DashboardPage.client.js
@@ -1,6 +1,7 @@
'use client';
import { getWidgets } from '../registry.js';
+import AdminHeader from '../components/AdminHeader.js';
export default function DashboardPage({ stats }) {
const loading = stats === null || stats === undefined;
@@ -8,10 +9,7 @@ export default function DashboardPage({ stats }) {
return (
-
-
Tableau de bord
-
Vue d'ensemble de votre application
-
+
{widgets.map(({ id, Component }) => (
diff --git a/src/features/admin/pages/ProfilePage.client.js b/src/features/admin/pages/ProfilePage.client.js
index 7f6ca96..a3ee13b 100644
--- a/src/features/admin/pages/ProfilePage.client.js
+++ b/src/features/admin/pages/ProfilePage.client.js
@@ -3,6 +3,7 @@
import React, { useState, useEffect, useRef } from 'react';
import { Card, Input, Button } from '@zen/core/shared/components';
import { useToast } from '@zen/core/toast';
+import AdminHeader from '../components/AdminHeader.js';
const ProfilePage = ({ user: initialUser }) => {
const toast = useToast();
@@ -181,17 +182,7 @@ const ProfilePage = ({ user: initialUser }) => {
return (
- {/* Header */}
-
-
-
- Mon profil
-
-
- Gérez les informations de votre compte
-
-
-
+
{/* Content */}
diff --git a/src/features/admin/pages/RoleEditPage.client.js b/src/features/admin/pages/RoleEditPage.client.js
index 3d2dcda..11304d4 100644
--- a/src/features/admin/pages/RoleEditPage.client.js
+++ b/src/features/admin/pages/RoleEditPage.client.js
@@ -5,6 +5,7 @@ import { useRouter } from 'next/navigation';
import { Card, Button, Input, Textarea, Switch } from '@zen/core/shared/components';
import { useToast } from '@zen/core/toast';
import { getPermissionGroups } from '@zen/core/users/constants';
+import AdminHeader from '../components/AdminHeader.js';
const PERMISSION_GROUPS = getPermissionGroups();
@@ -115,17 +116,11 @@ const RoleEditPage = ({ roleId }) => {
return (
-
-
-
-
{title}
- {isSystem && (
-
Rôle système — le nom ne peut pas être modifié
- )}
-
-
+