import { Link, useRouterState, useNavigate } from "@tanstack/react-router"; import { useEffect, useState, type ReactNode } from "react"; const navItems = [ { href: "/dashboard", label: "TABLEAU DE BORD", icon: "dashboard" as const }, { href: "/leads", label: "LISTE DES LEADS", icon: "leads" as const }, { href: "/stands", label: "ANALYSE DES STANDS", icon: "stands" as const }, { href: "/settings", label: "PARAMÈTRES DU MODÈLE", icon: "settings" as const }, ]; function NavIcon({ type, active }: { type: string; active: boolean }) { const color = active ? "var(--primary)" : "var(--muted-foreground)"; switch (type) { case "dashboard": return ( ); case "leads": return ( ); case "stands": return ( ); case "settings": return ( ); default: return null; } } export function AdminLayout({ title, subtitle, actions, children, }: { title: string; subtitle?: string; actions?: ReactNode; children: ReactNode; }) { const navigate = useNavigate(); const pathname = useRouterState({ select: (s) => s.location.pathname }); const [user, setUser] = useState<{ email: string; name: string }>({ email: "admin@letudiant.local", name: "admin", }); const [searchQuery, setSearchQuery] = useState(""); useEffect(() => { const auth = typeof window !== "undefined" ? localStorage.getItem("letudiant_auth") : null; if (!auth) { return; } try { setUser(JSON.parse(auth)); } catch { localStorage.removeItem("letudiant_auth"); } }, [navigate]); const handleLogout = () => { localStorage.removeItem("letudiant_auth"); navigate({ to: "/" }); }; if (!user) { return (
Chargement…
); } return (
setSearchQuery(e.target.value)} placeholder="Search parameters…" className="w-full pl-11 pr-4 py-3 rounded-2xl text-sm transition-all focus:outline-none focus:ring-2" style={{ background: "var(--surface-container)", border: "1px solid transparent", color: "var(--foreground)", }} />

Alex Rivers

Head of Growth

AR

{title}

{subtitle && (

{subtitle}

)}
{actions &&
{actions}
}
{children}
); }