batchCooking/apps/web/src/App.tsx
Nicolas c07f8ad82e Web: wire AppLayout into routing + stub section pages (step 3/5)
- App.tsx: every authenticated route now nests under one
  RequireAuth + AppLayout parent route (react-router nested
  routes/<Outlet />) instead of each page wrapping its own guard.
- New routes/pages: /recettes, /liste-de-courses, /foyer, each a thin
  wrapper around a shared ComingSoonPage ("cette section arrive
  bientôt.") — no backend behind them yet, matches the "pages stub
  dédiées" choice discussed in chat.
- locales/fr/translation.json: nav labels + stub copy.

HomePage still shows its own greeting/logout card here (unchanged,
now nested inside AppLayout's <Outlet /> — briefly duplicating the
sidebar's greeting/logout) — replaced by the actual planning view in
the next commit.
2026-08-16 21:04:51 +02:00

54 lines
1.8 KiB
TypeScript

import { Navigate, Route, Routes } from "react-router-dom";
import { RedirectIfAuthenticated } from "./features/auth/RedirectIfAuthenticated";
import { RequireAuth } from "./features/auth/RequireAuth";
import { AppLayout } from "./layouts/AppLayout";
import { HomePage } from "./pages/HomePage";
import { HouseholdPage } from "./pages/HouseholdPage";
import { LoginPage } from "./pages/LoginPage";
import { RecipesPage } from "./pages/RecipesPage";
import { ShoppingListPage } from "./pages/ShoppingListPage";
import { SignupPage } from "./pages/SignupPage";
/**
* Top-level route table. Every authenticated section is nested under one
* `RequireAuth` + `AppLayout` parent route (sidebar chrome + `/auth`
* guard applied once, not per-page — see {@link AppLayout}); `/login` and
* `/signup` redirect an already-logged-in visitor to `/` instead (see
* {@link RedirectIfAuthenticated}). Anything else falls back to `/`, which
* itself redirects to `/login` if needed.
*/
export function App() {
return (
<Routes>
<Route
element={
<RequireAuth>
<AppLayout />
</RequireAuth>
}
>
<Route path="/" element={<HomePage />} />
<Route path="/recettes" element={<RecipesPage />} />
<Route path="/liste-de-courses" element={<ShoppingListPage />} />
<Route path="/foyer" element={<HouseholdPage />} />
</Route>
<Route
path="/login"
element={
<RedirectIfAuthenticated>
<LoginPage />
</RedirectIfAuthenticated>
}
/>
<Route
path="/signup"
element={
<RedirectIfAuthenticated>
<SignupPage />
</RedirectIfAuthenticated>
}
/>
<Route path="*" element={<Navigate to="/" replace />} />
</Routes>
);
}