60e83d49dd
- Replace Vite boilerplate with React Router for page navigation - Add React Query for server state and cache management - Integrate shadcn/ui component library with Tailwind CSS v4 - Configure @/ path alias for clean module imports - Set up Vite dev proxy to API backend - Remove default App.css, App.tsx, and react.svg assets
64 lines
1.2 KiB
TypeScript
64 lines
1.2 KiB
TypeScript
import { createBrowserRouter, Navigate } from "react-router-dom"
|
|
import { ProtectedRoute, AdminRoute } from "./guards"
|
|
|
|
// Placeholder components — real pages will replace these
|
|
function LoginPage() {
|
|
return <div>Login</div>
|
|
}
|
|
function BooksPage() {
|
|
return <div>Books</div>
|
|
}
|
|
function MyBorrowsPage() {
|
|
return <div>My Borrows</div>
|
|
}
|
|
function AdminBooksPage() {
|
|
return <div>Admin / Books</div>
|
|
}
|
|
function AdminBorrowsPage() {
|
|
return <div>Admin / Borrows</div>
|
|
}
|
|
function AdminIndexPage() {
|
|
return <Navigate to="/admin/books" replace />
|
|
}
|
|
|
|
export const router = createBrowserRouter([
|
|
{
|
|
path: "/login",
|
|
element: <LoginPage />,
|
|
},
|
|
{
|
|
path: "/",
|
|
element: <Navigate to="/books" replace />,
|
|
},
|
|
{
|
|
path: "/books",
|
|
element: <BooksPage />,
|
|
},
|
|
{
|
|
element: <ProtectedRoute />,
|
|
children: [
|
|
{
|
|
path: "/my-borrows",
|
|
element: <MyBorrowsPage />,
|
|
},
|
|
],
|
|
},
|
|
{
|
|
element: <AdminRoute />,
|
|
children: [
|
|
{
|
|
path: "/admin",
|
|
element: <AdminIndexPage />,
|
|
},
|
|
{
|
|
path: "/admin/books",
|
|
element: <AdminBooksPage />,
|
|
},
|
|
{
|
|
path: "/admin/borrows",
|
|
element: <AdminBorrowsPage />,
|
|
},
|
|
],
|
|
},
|
|
])
|