Files
bookMgr-client/src/router/index.tsx
T
msksbr 60e83d49dd feat: initialize app with routing, query management, and UI framework
- 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
2026-05-24 19:19:08 +08:00

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 />,
},
],
},
])