import { useState } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';
import { useAuth } from '../context/AuthContext.jsx';
import UsersSection from './admin/UsersSection.jsx';
import CreateUserSection from './admin/CreateUserSection.jsx';
import JobLogsSection from './admin/JobLogsSection.jsx';
import IconsSection from './admin/IconsSection.jsx';
import SmtpSection from './admin/SmtpSection.jsx';
/* ── Icônes nav ───────────────────────────────────────────────── */
function IconUsers() { return ; }
function IconUserPlus() { return ; }
function IconActivity() { return ; }
function IconImage() { return ; }
function IconTax() { return ; }
function IconDatabase() { return ; }
function IconMail() { return ; }
const NAV = [
{
group: 'Administration de la plateforme',
items: [
{ id: 'users', label: 'Utilisateurs', icon: },
{ id: 'create', label: 'Créer un utilisateur', 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: },
],
},
];
export default function Admin() {
const { search } = useLocation();
const navigate = useNavigate();
const [refreshKey, setRefreshKey] = useState(0);
const { user } = useAuth();
const section = new URLSearchParams(search).get('section') || 'users';
if (!user) return null;
return (
{section === 'users' && }
{section === 'create' && setRefreshKey(k => k + 1)} />}
{section === 'job-logs' && }
{section === 'icons' && }
{section === 'smtp' && }
);
}