feat(admin): replace app name with dashboard icon in breadcrumb root
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import { Fragment } from 'react';
|
||||
import { Menu, MenuButton, MenuItem, MenuItems, Transition } from '@headlessui/react';
|
||||
import { ChevronDownIcon, User03Icon } from '@zen/core/shared/icons';
|
||||
import { ChevronDownIcon, User03Icon, DashboardSquare03Icon } from '@zen/core/shared/icons';
|
||||
import { UserAvatar } from '@zen/core/shared/components';
|
||||
import { useRouter, usePathname } from 'next/navigation';
|
||||
import { getPages } from '../registry.js';
|
||||
@@ -36,12 +36,12 @@ const AdminTop = ({ isMobileMenuOpen, setIsMobileMenuOpen, user, onLogout, appNa
|
||||
const themeLabel = theme === 'light' ? 'Mode clair' : theme === 'dark' ? 'Mode sombre' : 'Thème système';
|
||||
|
||||
const buildBreadcrumbs = () => {
|
||||
const crumbs = [{ label: appName, href: '/admin/dashboard' }];
|
||||
const crumbs = [{ icon: DashboardSquare03Icon, href: '/admin/dashboard' }];
|
||||
const after = pathname.replace(/^\/admin\/?/, '');
|
||||
if (!after) return crumbs;
|
||||
|
||||
const segments = after.split('/').filter(Boolean);
|
||||
if (!segments.length) return crumbs;
|
||||
if (!segments.length || (segments[0] === 'dashboard' && segments.length === 1)) return crumbs;
|
||||
|
||||
const [first, second] = segments;
|
||||
const allItems = navigationSections.flatMap(s => s.items);
|
||||
@@ -93,7 +93,14 @@ const AdminTop = ({ isMobileMenuOpen, setIsMobileMenuOpen, user, onLogout, appNa
|
||||
<polyline points="9 18 15 12 9 6" />
|
||||
</svg>
|
||||
)}
|
||||
{crumb.href ? (
|
||||
{crumb.icon ? (
|
||||
<button
|
||||
onClick={() => router.push(crumb.href)}
|
||||
className="text-neutral-500 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-white transition-colors cursor-pointer"
|
||||
>
|
||||
<crumb.icon className="w-4 h-4" />
|
||||
</button>
|
||||
) : crumb.href ? (
|
||||
<button
|
||||
onClick={() => router.push(crumb.href)}
|
||||
className="text-neutral-500 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-white transition-colors cursor-pointer"
|
||||
|
||||
Reference in New Issue
Block a user