feat: Stage 3 — application shell and navigation
This commit is contained in:
@@ -7,11 +7,16 @@
|
||||
* 3. `AuthProvider` — manages session state and exposes `useAuth()`.
|
||||
*
|
||||
* Routes:
|
||||
* - `/setup` — first-run setup wizard (always accessible, redirected to by backend middleware)
|
||||
* - `/login` — master password login
|
||||
* - `/` — dashboard (protected)
|
||||
* All other paths fall through to the dashboard guard; the full route tree
|
||||
* is wired up in Stage 3.
|
||||
* - `/setup` — first-run setup wizard (always accessible)
|
||||
* - `/login` — master password login
|
||||
* - `/` — dashboard (protected, inside MainLayout)
|
||||
* - `/map` — world map (protected)
|
||||
* - `/jails` — jail list (protected)
|
||||
* - `/jails/:name` — jail detail (protected)
|
||||
* - `/config` — configuration editor (protected)
|
||||
* - `/history` — event history (protected)
|
||||
* - `/blocklists` — blocklist management (protected)
|
||||
* All unmatched paths redirect to `/`.
|
||||
*/
|
||||
|
||||
import { FluentProvider } from "@fluentui/react-components";
|
||||
@@ -19,9 +24,16 @@ import { BrowserRouter, Navigate, Route, Routes } from "react-router-dom";
|
||||
import { lightTheme } from "./theme/customTheme";
|
||||
import { AuthProvider } from "./providers/AuthProvider";
|
||||
import { RequireAuth } from "./components/RequireAuth";
|
||||
import { MainLayout } from "./layouts/MainLayout";
|
||||
import { SetupPage } from "./pages/SetupPage";
|
||||
import { LoginPage } from "./pages/LoginPage";
|
||||
import { DashboardPage } from "./pages/DashboardPage";
|
||||
import { MapPage } from "./pages/MapPage";
|
||||
import { JailsPage } from "./pages/JailsPage";
|
||||
import { JailDetailPage } from "./pages/JailDetailPage";
|
||||
import { ConfigPage } from "./pages/ConfigPage";
|
||||
import { HistoryPage } from "./pages/HistoryPage";
|
||||
import { BlocklistsPage } from "./pages/BlocklistsPage";
|
||||
|
||||
/**
|
||||
* Root application component — mounts providers and top-level routes.
|
||||
@@ -36,17 +48,24 @@ function App(): JSX.Element {
|
||||
<Route path="/setup" element={<SetupPage />} />
|
||||
<Route path="/login" element={<LoginPage />} />
|
||||
|
||||
{/* Protected routes */}
|
||||
{/* Protected routes — all rendered inside MainLayout */}
|
||||
<Route
|
||||
path="/"
|
||||
element={
|
||||
<RequireAuth>
|
||||
<DashboardPage />
|
||||
<MainLayout />
|
||||
</RequireAuth>
|
||||
}
|
||||
/>
|
||||
>
|
||||
<Route index element={<DashboardPage />} />
|
||||
<Route path="/map" element={<MapPage />} />
|
||||
<Route path="/jails" element={<JailsPage />} />
|
||||
<Route path="/jails/:name" element={<JailDetailPage />} />
|
||||
<Route path="/config" element={<ConfigPage />} />
|
||||
<Route path="/history" element={<HistoryPage />} />
|
||||
<Route path="/blocklists" element={<BlocklistsPage />} />
|
||||
</Route>
|
||||
|
||||
{/* Fallback — redirect unknown paths to dashboard (guard will redirect to login if needed) */}
|
||||
{/* Fallback — redirect unknown paths to dashboard */}
|
||||
<Route path="*" element={<Navigate to="/" replace />} />
|
||||
</Routes>
|
||||
</AuthProvider>
|
||||
|
||||
Reference in New Issue
Block a user