chore: import codes

This commit is contained in:
2026-04-12 12:50:14 -04:00
parent 4bcb4898e8
commit 65ae3c6788
241 changed files with 48834 additions and 1 deletions
+69
View File
@@ -0,0 +1,69 @@
/**
* Admin Navigation Builder (Server-Only)
*
* This file imports from the module registry and should ONLY be used on the server.
* It builds the complete navigation including dynamic module navigation.
*
* IMPORTANT: This file is NOT bundled to ensure it shares the same registry instance
* that was populated during module discovery.
*
* IMPORTANT: We import from '@hykocx/zen' (main package) to use the same registry
* instance that was populated during initializeZen(). DO NOT import from
* '@hykocx/zen/core/modules' as that's a separate bundle with its own registry.
*
* IMPORTANT: Navigation data must be serializable (no functions/components).
* Icons are passed as string names and resolved on the client.
*/
// Import from the main package to use the same registry as discovery
import { moduleSystem } from '@hykocx/zen';
const { getAllAdminNavigation } = moduleSystem;
/**
* Build complete navigation sections including modules
* This should ONLY be called on the server (in page.js)
* @param {string} pathname - Current pathname
* @param {Object} enabledModules - Object with module names as keys (for compatibility)
* @returns {Array} Complete navigation sections (serializable, icons as strings)
*/
export function buildNavigationSections(pathname, enabledModules = null) {
// Core navigation sections (always available)
// Use icon NAMES (strings) for serialization across server/client boundary
const coreNavigation = [
{
id: 'Dashboard',
title: 'Tableau de bord',
icon: 'DashboardSquare03Icon',
items: [
{
name: 'Tableau de bord',
href: '/admin/dashboard',
icon: 'DashboardSquare03Icon',
current: pathname === '/admin/dashboard'
},
]
}
];
// Get module navigation from registry (only works on server)
const moduleNavigation = getAllAdminNavigation(pathname);
// System navigation (always at the end)
const systemNavigation = [
{
id: 'users',
title: 'Utilisateurs',
icon: 'UserMultiple02Icon',
items: [
{
name: 'Utilisateurs',
href: '/admin/users',
icon: 'UserMultiple02Icon',
current: pathname.startsWith('/admin/users')
},
]
}
];
return [...coreNavigation, ...moduleNavigation, ...systemNavigation];
}