doli-front/src/pages/pagesRegistry.js

47 lines
908 B
JavaScript
Raw Normal View History

// Registry of all pages available in the application
export const pagesRegistry = [
{
route: 'dashboard',
name: 'Dashboard',
icon: '🏠',
requiresAuth: true
},
{
route: 'test',
name: 'Test Page',
icon: '🧪',
requiresAuth: true
},
{
route: 'invoices',
name: 'Facturas',
icon: '📄',
requiresAuth: true
},
{
route: 'clients',
name: 'Clientes',
icon: '👥',
requiresAuth: true
},
{
route: 'settings',
name: 'Configuración',
icon: '⚙️',
requiresAuth: true
}
];
// Get pages that the user can access
export function getAvailablePages(isAuthenticated) {
if (!isAuthenticated) {
return [];
}
return pagesRegistry.filter(page => !page.requiresAuth || isAuthenticated);
}
// Get page by route
export function getPageByRoute(route) {
return pagesRegistry.find(page => page.route === route);
}