M1: implement operational core
Demo auth, seed import/reset, dashboard, vehicle/booking list+detail, audit trail. Backend: 19 tests passing, ruff clean. Frontend: React Router shell, typed API client, responsive pages. Verified end-to-end via curl and browser.
This commit is contained in:
+32
-44
@@ -1,49 +1,37 @@
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
const API = import.meta.env.VITE_API_BASE_URL ?? "";
|
||||
|
||||
type Status = {
|
||||
service: string;
|
||||
environment: string;
|
||||
demo_mode: boolean;
|
||||
knowledge_provider: string;
|
||||
scaffold: boolean;
|
||||
};
|
||||
import { Navigate, Route, Routes } from "react-router-dom";
|
||||
import { AuthProvider } from "./context/AuthContext";
|
||||
import { Layout } from "./components/Layout";
|
||||
import { RequireAuth } from "./components/RequireAuth";
|
||||
import { Login } from "./pages/Login";
|
||||
import { Dashboard } from "./pages/Dashboard";
|
||||
import { Vehicles } from "./pages/Vehicles";
|
||||
import { VehicleDetail } from "./pages/VehicleDetail";
|
||||
import { Bookings } from "./pages/Bookings";
|
||||
import { BookingDetail } from "./pages/BookingDetail";
|
||||
import { Audit } from "./pages/Audit";
|
||||
|
||||
export function App() {
|
||||
const [status, setStatus] = useState<Status | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
fetch(`${API}/api/v1/system/status`)
|
||||
.then((response) => {
|
||||
if (!response.ok) throw new Error(`API returned ${response.status}`);
|
||||
return response.json();
|
||||
})
|
||||
.then(setStatus)
|
||||
.catch((reason: unknown) => setError(reason instanceof Error ? reason.message : "Unknown error"));
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<main className="shell">
|
||||
<section className="hero">
|
||||
<p className="eyebrow">Synthetic proof of concept</p>
|
||||
<h1>MobilityOps</h1>
|
||||
<p>Connected operations for vehicle rental and service teams.</p>
|
||||
</section>
|
||||
<section className="panel" aria-live="polite">
|
||||
<h2>Scaffold status</h2>
|
||||
{error && <p className="error">API unavailable: {error}</p>}
|
||||
{!error && !status && <p>Connecting to the MobilityOps API…</p>}
|
||||
{status && (
|
||||
<dl>
|
||||
<div><dt>Service</dt><dd>{status.service}</dd></div>
|
||||
<div><dt>Environment</dt><dd>{status.environment}</dd></div>
|
||||
<div><dt>Knowledge provider</dt><dd>{status.knowledge_provider}</dd></div>
|
||||
</dl>
|
||||
)}
|
||||
<p className="note">This is the bootable project scaffold. Claude must replace it with the complete scoped application described in the build pack.</p>
|
||||
</section>
|
||||
</main>
|
||||
<AuthProvider>
|
||||
<Routes>
|
||||
<Route path="/login" element={<Login />} />
|
||||
<Route
|
||||
element={
|
||||
<RequireAuth>
|
||||
<Layout />
|
||||
</RequireAuth>
|
||||
}
|
||||
>
|
||||
<Route path="/dashboard" element={<Dashboard />} />
|
||||
<Route path="/vehicles" element={<Vehicles />} />
|
||||
<Route path="/vehicles/:publicRef" element={<VehicleDetail />} />
|
||||
<Route path="/bookings" element={<Bookings />} />
|
||||
<Route path="/bookings/:publicRef" element={<BookingDetail />} />
|
||||
<Route path="/audit" element={<Audit />} />
|
||||
</Route>
|
||||
<Route path="/" element={<Navigate to="/dashboard" replace />} />
|
||||
<Route path="*" element={<Navigate to="/dashboard" replace />} />
|
||||
</Routes>
|
||||
</AuthProvider>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user