Fusionne l'espace admin dans l'espace membre : connexion unique
- Le menu public n'affiche plus « Espace admin » — un seul lien « Espace membre » pour tous les comptes - /espace-membre devient le point de connexion unique : après connexion, le contenu affiché dépend du rôle du compte (portail membre avec header du site, ou back-office admin plein écran avec sa propre barre latérale) - Admin.jsx exporte désormais AdminShell (coquille admin authentifiée, sans logique de connexion) réutilisée par Espace.jsx ; l'export par défaut devient une redirection de /admin vers /espace-membre pour ne pas casser d'anciens liens - App.jsx masque le header/footer public uniquement quand un admin est affiché sur /espace-membre (ou sur l'ancienne route /admin) Vérifié : navigation sans lien admin, /admin redirige, connexion membre → portail avec header, connexion admin → back-office sans header ; 34 tests e2e toujours au vert. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fkg15RCxNgUys4ru73He2o
This commit is contained in:
4 files changed
+26
-27
No files matched your search
@@ -2,6 +2,7 @@ import { useEffect, useState } from 'react';
|
||||
import { useAuth } from '../lib/AuthContext.jsx';
|
||||
import { api, seasonLabel } from '../lib/api.js';
|
||||
import ImageSlot from '../components/ImageSlot.jsx';
|
||||
import { AdminShell } from './Admin.jsx';
|
||||
|
||||
function LoginSection({ title = 'Gérez votre présence au Club', kicker = 'Espace membre' }) {
|
||||
const { login } = useAuth();
|
||||
@@ -266,12 +267,14 @@ function Portal() {
|
||||
);
|
||||
}
|
||||
|
||||
// Single login entry point for both members and admins. Once authenticated,
|
||||
// the content shown depends on the account's role — the URL and the login
|
||||
// form never differ.
|
||||
export default function Espace() {
|
||||
const { user, loading } = useAuth();
|
||||
|
||||
if (loading) return <main style={{ minHeight: '60vh' }} />;
|
||||
if (!user || user.role !== 'member') return <main><LoginSection /></main>;
|
||||
if (!user) return <main><LoginSection /></main>;
|
||||
if (user.role === 'admin') return <AdminShell />;
|
||||
return <main><Portal /></main>;
|
||||
}
|
||||
|
||||
export { LoginSection };
|
||||
Reference in new issue
Block a user