import { Outlet, Link, createFileRoute, redirect, useRouterState, } from "@tanstack/react-router"; import { authStore } from "@/lib/auth"; import { Brand } from "@/components/brand/Brand"; import { Stepper } from "@/components/ui/Stepper"; const ONBOARDING_STEPS = [ { id: "compte", label: "Compte", path: "/onboarding/compte" }, { id: "entreprise", label: "Entreprise", path: "/onboarding/entreprise" }, { id: "signature", label: "Signature", path: "/onboarding/signature" }, ] as const; export const Route = createFileRoute("/onboarding")({ beforeLoad: ({ location }) => { if (!authStore.isAuthenticated()) { throw redirect({ to: "/login", search: { redirect: location.href } }); } }, component: OnboardingLayout, }); function OnboardingLayout() { const pathname = useRouterState({ select: (s) => s.location.pathname }); const currentIndex = Math.max( 0, ONBOARDING_STEPS.findIndex((s) => pathname.startsWith(s.path)), ); return (
{/* Header minimal — pas de sidebar, pas de nav, juste la marque + le stepper. */}

Étape {currentIndex + 1} sur {ONBOARDING_STEPS.length}

({ id, label }))} currentIndex={currentIndex} />
); }