import { useLocation, useNavigate } from 'react-router-dom'; import { useAuth } from '../context/AuthContext.jsx'; import UsersSection from './admin/UsersSection.jsx'; import AuditLogsSection from './admin/AuditLogsSection.jsx'; import JobLogsSection from './admin/JobLogsSection.jsx'; import IconsSection from './admin/IconsSection.jsx'; import SmtpSection from './admin/SmtpSection.jsx'; import GeneralSection from './admin/GeneralSection.jsx'; import ExportSection from './admin/ExportSection.jsx'; /* ── Icônes nav ───────────────────────────────────────────────── */ function IconUsers() { return ; } function IconActivity() { return ; } function IconShield() { return ; } function IconImage() { return ; } function IconTax() { return ; } function IconDatabase() { return ; } function IconSettings() { return ; } function IconMail() { return ; } function IconDownload() { return ; } const NAV = [ { group: 'Administration de la plateforme', items: [ { id: 'general', label: 'Général', icon: }, { id: 'users', label: 'Utilisateurs', icon: }, { id: 'audit-logs', label: 'Audit', icon: }, { id: 'job-logs', label: 'Logs des jobs', icon: }, { id: 'icons', label: "Bibliothèque d'icônes", icon: }, ], }, { group: 'Référentiels', items: [ { id: 'plateformes', label: 'Plateformes', icon: , href: '/admin/plateformes' }, { id: 'fiscalite', label: 'Fiscalité', icon: , href: '/admin/fiscalite' }, ], }, { group: 'Notifications', items: [ { id: 'smtp', label: 'SMTP', icon: }, ], }, { group: 'Maintenance', items: [ { id: 'export', label: 'Export complet', icon: }, ], }, ]; export default function Admin() { const { search } = useLocation(); const navigate = useNavigate(); const { user } = useAuth(); const section = new URLSearchParams(search).get('section') || 'users'; if (!user) return null; return (
{section === 'general' && } {section === 'users' && } {section === 'audit-logs' && } {section === 'job-logs' && } {section === 'icons' && } {section === 'smtp' && } {section === 'export' && }
); }