Files
braidsbymira/src/App.tsx
belviskhoremk 540b8b407b feat: wire up /admin/* routing
Adds AdminApp as a lazy-loaded route subtree in App.tsx, mounting
ProtectedRoute, AdminLogin, AdminLayout, and all five CRUD pages built
in Tasks 3-11. Mounted as a sibling of the public Layout route (not
nested under it), since the admin panel has its own AdminLayout
sidebar rather than the public nav/footer.

Manually verified end-to-end against the local Supabase stack: sign-in
redirect guard, all five pages rendering real seeded data, creating and
cancelling a real booking through the UI (confirming the booked_slots
cleanup trigger from the merged Phase 2A follow-up fixes correctly
frees the slot), and sign-out. No console errors across the flow.

Claude-Session: https://claude.ai/code/session_01NhxA4npAXAxmCDEJt6kxSH
2026-08-12 12:52:25 +02:00

59 lines
1.3 KiB
TypeScript

import { lazy, Suspense } from 'react'
import { BrowserRouter, MemoryRouter, Routes, Route } from 'react-router-dom'
import Layout from './components/Layout'
import Shop from './pages/Shop'
import Book from './pages/Book'
import Rules from './pages/Rules'
const Home = lazy(() => import('./pages/Home'))
const AdminApp = lazy(() => import('./pages/admin/AdminApp'))
interface AppProps {
initialEntries?: string[]
}
function AppRoutes() {
return (
<Routes>
<Route element={<Layout />}>
<Route
path="/"
element={
<Suspense fallback={null}>
<Home />
</Suspense>
}
/>
<Route path="/shop" element={<Shop />} />
<Route path="/book" element={<Book />} />
<Route path="/rules" element={<Rules />} />
</Route>
<Route
path="/admin/*"
element={
<Suspense fallback={null}>
<AdminApp />
</Suspense>
}
/>
</Routes>
)
}
function App({ initialEntries }: AppProps) {
if (initialEntries) {
return (
<MemoryRouter initialEntries={initialEntries}>
<AppRoutes />
</MemoryRouter>
)
}
return (
<BrowserRouter>
<AppRoutes />
</BrowserRouter>
)
}
export default App