2026-01-16 20:22:14 +00:00
|
|
|
// 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 [];
|
|
|
|
|
}
|
2026-01-16 20:25:22 +00:00
|
|
|
// Filter pages based on authentication requirement
|
2026-01-16 20:22:14 +00:00
|
|
|
return pagesRegistry.filter(page => !page.requiresAuth || isAuthenticated);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get page by route
|
|
|
|
|
export function getPageByRoute(route) {
|
|
|
|
|
return pagesRegistry.find(page => page.route === route);
|
|
|
|
|
}
|