import { useLocation } from "wouter"; import { useAuth } from "@/_core/hooks/useAuth"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { APP_LOGO, APP_TITLE, getLoginUrl } from "@/const"; import { KeyRound, Shield } from "lucide-react"; import { useEffect } from "react"; export default function LoginChoice() { const [, setLocation] = useLocation(); const { user, loading, isAuthenticated } = useAuth(); // Rediriger les utilisateurs déjà connectés vers le tableau de bord useEffect(() => { if (!loading && isAuthenticated && user?.role === 'admin') { setLocation('/admin'); } }, [loading, isAuthenticated, user?.role, setLocation]); const handleManusLogin = () => { window.location.href = getLoginUrl(); }; const handleLocalLogin = () => { setLocation("/login"); }; // Afficher un loader pendant la vérification de l'authentification if (loading) { return (
); } // Ne pas afficher la page si l'utilisateur est déjà connecté (redirection en cours) if (isAuthenticated && user?.role === 'admin') { return null; } return (
Logo
{APP_TITLE} Choisissez votre méthode de connexion
{/* Connexion Manus OAuth */}
Connexion Manus Utilisez votre compte Manus (Google, Microsoft, Apple)
{/* Connexion Locale */}
Connexion Locale Utilisez votre identifiant et mot de passe

Vous n'avez pas de compte ?

Contactez l'administrateur

); }