import { createBrowserRouter, Navigate, type RouteObject } from 'react-router' import LoginPage from './auth/LoginPage' import RegisterPage from './auth/RegisterPage' import { RequireAuth, RequireGuest } from './auth/guards' import ScenarioShowPage from './pages/ScenarioShowPage' import ScenariosPage from './pages/ScenariosPage' /** * Application route tree. Guards are layout routes: their children render via * only when the guard allows it (RequireGuest = signed-out users, * RequireAuth = signed-in users). Add new pages as children of the appropriate * guard. * * Exported as a plain array so tests can drive the real route config through * createMemoryRouter (see router.test.tsx). */ export const routes: RouteObject[] = [ { element: , children: [ { path: '/login', element: }, { path: '/register', element: }, ], }, { element: , children: [ { path: '/', element: }, { path: '/scenarios/:id', element: }, ], }, // Unknown paths fall back to the app root (which re-guards). { path: '*', element: }, ] export const router = createBrowserRouter(routes)