Backend: - Add 2FA authentication with TOTP support - Add API keys management system - Add audit logging for security events - Add file upload/management system - Add notifications system with preferences - Add session management - Add webhooks integration - Add analytics endpoints - Add export functionality - Add password policy enforcement - Add new database migrations for core tables Frontend: - Add module position system (top/bottom sidebar sections) - Add search and notifications module configuration tabs - Add mobile logo replacing hamburger menu - Center page title absolutely when no tabs present - Align sidebar footer toggles with navigation items - Add lighter icon color in dark theme for mobile - Add API keys management page - Add notifications page with context - Add admin analytics and audit logs pages 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
129 lines
2.9 KiB
TypeScript
129 lines
2.9 KiB
TypeScript
import type { ReactNode } from 'react';
|
|
|
|
export interface Module {
|
|
id: string;
|
|
name: string;
|
|
icon: string;
|
|
path: string;
|
|
component: ReactNode;
|
|
enabled: boolean;
|
|
requiresAuth: boolean;
|
|
requiresAdmin?: boolean;
|
|
}
|
|
|
|
export interface ModuleCategory {
|
|
id: string;
|
|
name: string;
|
|
modules: Module[];
|
|
}
|
|
|
|
// Define available modules
|
|
export const appModules: ModuleCategory[] = [
|
|
{
|
|
id: 'main',
|
|
name: 'Main Features',
|
|
modules: [
|
|
{
|
|
id: 'dashboard',
|
|
name: 'sidebar.dashboard',
|
|
icon: 'dashboard',
|
|
path: '/dashboard',
|
|
component: null, // Will be lazy loaded
|
|
enabled: true,
|
|
requiresAuth: true,
|
|
},
|
|
{
|
|
id: 'search',
|
|
name: 'sidebar.search',
|
|
icon: 'search',
|
|
path: '/search',
|
|
component: null,
|
|
enabled: true,
|
|
requiresAuth: true,
|
|
},
|
|
{
|
|
id: 'notifications',
|
|
name: 'sidebar.notifications',
|
|
icon: 'notifications',
|
|
path: '/notifications',
|
|
component: null,
|
|
enabled: true,
|
|
requiresAuth: true,
|
|
},
|
|
{
|
|
id: 'feature1',
|
|
name: 'sidebar.feature1',
|
|
icon: 'playlist_play',
|
|
path: '/feature1',
|
|
component: null,
|
|
enabled: true,
|
|
requiresAuth: true,
|
|
},
|
|
{
|
|
id: 'feature2',
|
|
name: 'sidebar.feature2',
|
|
icon: 'download',
|
|
path: '/feature2',
|
|
component: null,
|
|
enabled: true,
|
|
requiresAuth: true,
|
|
},
|
|
{
|
|
id: 'feature3',
|
|
name: 'sidebar.feature3',
|
|
icon: 'cast',
|
|
path: '/feature3',
|
|
component: null,
|
|
enabled: true,
|
|
requiresAuth: true,
|
|
},
|
|
],
|
|
},
|
|
{
|
|
id: 'admin',
|
|
name: 'Administration',
|
|
modules: [
|
|
{
|
|
id: 'users',
|
|
name: 'sidebar.users',
|
|
icon: 'group',
|
|
path: '/admin/users',
|
|
component: null,
|
|
enabled: true,
|
|
requiresAuth: true,
|
|
requiresAdmin: true,
|
|
},
|
|
{
|
|
id: 'settings',
|
|
name: 'sidebar.settings',
|
|
icon: 'settings',
|
|
path: '/settings',
|
|
component: null,
|
|
enabled: true,
|
|
requiresAuth: true,
|
|
},
|
|
],
|
|
},
|
|
];
|
|
|
|
// Helper to get enabled modules
|
|
export function getEnabledModules(isAdmin: boolean = false): Module[] {
|
|
const allModules = appModules.flatMap((category) => category.modules);
|
|
return allModules.filter((module) => {
|
|
if (!module.enabled) return false;
|
|
if (module.requiresAdmin && !isAdmin) return false;
|
|
return true;
|
|
});
|
|
}
|
|
|
|
// Helper to get modules by category
|
|
export function getModulesByCategory(categoryId: string, isAdmin: boolean = false): Module[] {
|
|
const category = appModules.find((cat) => cat.id === categoryId);
|
|
if (!category) return [];
|
|
return category.modules.filter((module) => {
|
|
if (!module.enabled) return false;
|
|
if (module.requiresAdmin && !isAdmin) return false;
|
|
return true;
|
|
});
|
|
}
|