feat(admin): add bottom navigation items and settings page to admin panel
This commit is contained in:
@@ -12,6 +12,7 @@ registerNavSection({ id: 'system', title: 'Utilisateurs', icon: 'UserMulti
|
||||
registerNavItem({ id: 'dashboard', label: 'Tableau de bord', icon: 'DashboardSquare03Icon', href: '/admin/dashboard', sectionId: 'dashboard', order: 10 });
|
||||
registerNavItem({ id: 'users', label: 'Utilisateurs', icon: 'UserMultiple02Icon', href: '/admin/users', sectionId: 'system', order: 10 });
|
||||
registerNavItem({ id: 'roles', label: 'Rôles', icon: 'Crown03Icon', href: '/admin/roles', sectionId: 'system', order: 20 });
|
||||
registerNavItem({ id: 'settings', label: 'Paramètres', icon: 'Settings02Icon', href: '/admin/settings', position: 'bottom', order: 10 });
|
||||
|
||||
/**
|
||||
* Build sections for AdminSidebar. Items are sérialisables (pas de composants),
|
||||
@@ -19,7 +20,7 @@ registerNavItem({ id: 'roles', label: 'Rôles', icon: 'Crown03Icon'
|
||||
*/
|
||||
export function buildNavigationSections(pathname) {
|
||||
const sections = getNavSections();
|
||||
const items = getNavItems();
|
||||
const items = getNavItems().filter(item => item.position !== 'bottom');
|
||||
|
||||
const bySection = new Map();
|
||||
for (const item of items) {
|
||||
@@ -37,3 +38,18 @@ export function buildNavigationSections(pathname) {
|
||||
.filter(s => bySection.has(s.id))
|
||||
.map(s => ({ id: s.id, title: s.title, icon: s.icon, items: bySection.get(s.id) }));
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the list of bottom-pinned nav items for AdminSidebar.
|
||||
*/
|
||||
export function buildBottomNavItems(pathname) {
|
||||
return getNavItems()
|
||||
.filter(item => item.position === 'bottom')
|
||||
.sort((a, b) => (a.order ?? 0) - (b.order ?? 0))
|
||||
.map(item => ({
|
||||
name: item.label,
|
||||
href: item.href,
|
||||
icon: item.icon,
|
||||
current: pathname === item.href || pathname.startsWith(item.href + '/'),
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user