Nouvelles routes : - /signup : inscription (fullName + email + password) → /onboarding/compte - /onboarding : layout avec brand + stepper, auth-guard - /onboarding/compte : étape 1 (nom + email, prefilled depuis la session) - /onboarding/entreprise : étape 2 (nom, SIRET optionnel, chips volume) - /onboarding/signature : étape 3 (signature email + aperçu live) Nouvelles primitives UI : - <Card variant="default|flat|hero" padding="sm|md|lg"> - <Stepper> wizard horizontal (current rubis, done rubis-glow + ✓, todo line) - <Chip selected> : pastille pill, glow + deep quand sélectionnée (le rubis plein reste réservé aux CTA, cf. règle "le rubis est rare") - <Textarea> : mêmes règles a11y/focus que <Input> MSW handlers étendus : - PATCH /api/v1/account/profile (fullName, email, signature) - PATCH /api/v1/organizations/me (name, siret, monthlyVolumeBucket) - mockDb : ajout des organizations, méthodes updateUser/updateOrg Wiring : - /login → "Créer un compte" pointe vers /signup (avant : loop) - /login succès → / (au lieu de /login) - / → /onboarding/compte si auth, /login sinon (placeholder dashboard) - /onboarding/signature succès → / Bundle prod : 113.87 KB gzip core (-2 KB grâce à MSW exclu en prod via import.meta.env.DEV). Chaque route en chunk dédié (1-2 KB gzip). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
24 lines
758 B
TypeScript
24 lines
758 B
TypeScript
import { createFileRoute, redirect } from "@tanstack/react-router";
|
|
import { authStore } from "@/lib/auth";
|
|
|
|
/**
|
|
* "/" — pas d'UI propre, juste un router.
|
|
*
|
|
* Décision actuelle :
|
|
* - non authentifié → /login
|
|
* - authentifié → /onboarding/compte (placeholder tant que le layout
|
|
* `_app` et le dashboard n'existent pas)
|
|
*
|
|
* Quand le layout `_app` arrivera, on enverra plutôt vers / côté `_app`,
|
|
* qui lui-même décidera entre dashboard et onboarding selon
|
|
* `organization.onboardingCompletedAt`.
|
|
*/
|
|
export const Route = createFileRoute("/")({
|
|
beforeLoad: () => {
|
|
if (!authStore.isAuthenticated()) {
|
|
throw redirect({ to: "/login" });
|
|
}
|
|
throw redirect({ to: "/onboarding/compte" });
|
|
},
|
|
});
|