68 lines
2.6 KiB
TypeScript
68 lines
2.6 KiB
TypeScript
import { Route, Routes } from "react-router-dom";
|
|
import { Toaster } from "sonner";
|
|
import { Layout } from "@/components/Layout";
|
|
import { DrillStackProvider } from "@/components/drill/DrillStackProvider";
|
|
import { Dashboard } from "@/pages/Dashboard";
|
|
import { Claims } from "@/pages/Claims";
|
|
import { Remittances } from "@/pages/Remittances";
|
|
import { Providers } from "@/pages/Providers";
|
|
import { ActivityLog } from "@/pages/ActivityLog";
|
|
import { Upload } from "@/pages/Upload";
|
|
import { ReconciliationPage } from "@/pages/Reconciliation";
|
|
import { Acks } from "@/pages/Acks";
|
|
import { Batches } from "@/pages/Batches";
|
|
import { BatchDiff } from "@/pages/BatchDiff";
|
|
import Inbox from "@/pages/Inbox";
|
|
import { Login } from "@/pages/Login";
|
|
import { RequireAuth } from "@/auth/RequireAuth";
|
|
|
|
function NotFound() {
|
|
return (
|
|
<div className="min-h-[60vh] flex flex-col items-center justify-center text-center">
|
|
<div className="display text-[80px] text-muted-foreground/40">404</div>
|
|
<p className="text-muted-foreground">That page doesn't exist.</p>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default function App() {
|
|
return (
|
|
<DrillStackProvider>
|
|
<Routes>
|
|
{/* /login sits OUTSIDE the auth-gated Layout so an
|
|
unauthenticated operator can reach the sign-in screen. */}
|
|
<Route path="/login" element={<Login />} />
|
|
{/* Every other route inherits the auth gate via RequireAuth
|
|
wrapping the Layout outlet. Authenticated operators see
|
|
the full app; unauthenticated ones are bounced back here
|
|
with `?next=<current>`. */}
|
|
<Route element={<RequireAuth><Layout /></RequireAuth>}>
|
|
<Route index element={<Dashboard />} />
|
|
<Route path="claims" element={<Claims />} />
|
|
<Route path="remittances" element={<Remittances />} />
|
|
<Route path="providers" element={<Providers />} />
|
|
<Route path="activity" element={<ActivityLog />} />
|
|
<Route path="upload" element={<Upload />} />
|
|
<Route path="reconciliation" element={<ReconciliationPage />} />
|
|
<Route path="inbox" element={<Inbox />} />
|
|
<Route path="acks" element={<Acks />} />
|
|
<Route path="batches" element={<Batches />} />
|
|
<Route path="batch-diff" element={<BatchDiff />} />
|
|
<Route path="*" element={<NotFound />} />
|
|
</Route>
|
|
</Routes>
|
|
<Toaster
|
|
position="bottom-right"
|
|
theme="dark"
|
|
toastOptions={{
|
|
style: {
|
|
background: "hsl(var(--card))",
|
|
border: "1px solid hsl(var(--border))",
|
|
color: "hsl(var(--foreground))",
|
|
},
|
|
}}
|
|
/>
|
|
</DrillStackProvider>
|
|
);
|
|
}
|