phase 3 completed
This commit is contained in:
+31
-18
@@ -1,4 +1,4 @@
|
||||
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'
|
||||
import { BrowserRouter, Routes, Route } from 'react-router-dom'
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||
import { AppShell } from './components/layout/AppShell'
|
||||
import { AuthProvider } from './contexts/AuthContext'
|
||||
@@ -17,7 +17,6 @@ const queryClient = new QueryClient({
|
||||
},
|
||||
})
|
||||
|
||||
// Pages — code-split per route
|
||||
const LoginPage = lazy(() => import('./pages/LoginPage'))
|
||||
const RegisterPage = lazy(() => import('./pages/RegisterPage'))
|
||||
const DashboardPage = lazy(() => import('./pages/DashboardPage'))
|
||||
@@ -40,6 +39,15 @@ function CSRFBootstrap() {
|
||||
return null
|
||||
}
|
||||
|
||||
function NotFound() {
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center h-full gap-3 text-center py-24">
|
||||
<p className="text-4xl font-bold text-[#DFE1E6]">404</p>
|
||||
<p className="text-sm text-[#5E6C84]">Page not found.</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
@@ -47,23 +55,28 @@ export default function App() {
|
||||
<CSRFBootstrap />
|
||||
<AuthProvider>
|
||||
<Routes>
|
||||
{/* Public — no shell */}
|
||||
<Route path="login" element={<S><LoginPage /></S>} />
|
||||
<Route path="register" element={<S><RegisterPage /></S>} />
|
||||
{/* Auth pages — full screen, no shell */}
|
||||
<Route path="/login" element={<S><LoginPage /></S>} />
|
||||
<Route path="/register" element={<S><RegisterPage /></S>} />
|
||||
|
||||
{/* App shell wraps all authenticated pages */}
|
||||
<Route element={<AppShell />}>
|
||||
<Route index element={<S><DashboardPage /></S>} />
|
||||
<Route path="repos" element={<S><ReposPage /></S>} />
|
||||
<Route path="repos/:owner/:repo" element={<S><RepoPage /></S>} />
|
||||
<Route path="repos/:owner/:repo/pulls" element={<S><RepoPRsPage /></S>} />
|
||||
<Route path="repos/:owner/:repo/pulls/:prId" element={<S><PRDetailPage /></S>} />
|
||||
<Route path="pulls" element={<S><PRsPage /></S>} />
|
||||
<Route path="pipelines" element={<S><PipelinesPage /></S>} />
|
||||
<Route path="explore" element={<S><ExplorePage /></S>} />
|
||||
<Route path="profile" element={<S><ProfilePage /></S>} />
|
||||
<Route path="settings" element={<S><SettingsPage /></S>} />
|
||||
<Route path="*" element={<Navigate to="/" replace />} />
|
||||
{/* Shell layout — explicit root path prevents ambiguous wildcard matching */}
|
||||
<Route path="/" element={<AppShell />}>
|
||||
<Route index element={<S><DashboardPage /></S>} />
|
||||
|
||||
{/* Repos — nested so /repos/:owner/:repo is unambiguous */}
|
||||
<Route path="repos" element={<S><ReposPage /></S>} />
|
||||
<Route path="repos/:owner/:repo" element={<S><RepoPage /></S>} />
|
||||
<Route path="repos/:owner/:repo/pulls" element={<S><RepoPRsPage /></S>} />
|
||||
<Route path="repos/:owner/:repo/pulls/:prId" element={<S><PRDetailPage /></S>} />
|
||||
|
||||
<Route path="pulls" element={<S><PRsPage /></S>} />
|
||||
<Route path="pipelines" element={<S><PipelinesPage /></S>} />
|
||||
<Route path="explore" element={<S><ExplorePage /></S>} />
|
||||
<Route path="profile" element={<S><ProfilePage /></S>} />
|
||||
<Route path="settings" element={<S><SettingsPage /></S>} />
|
||||
|
||||
{/* 404 within shell — shows a message, does NOT redirect */}
|
||||
<Route path="*" element={<NotFound />} />
|
||||
</Route>
|
||||
</Routes>
|
||||
</AuthProvider>
|
||||
|
||||
Reference in New Issue
Block a user