|
@@ -2,6 +2,14 @@ import { Navigate, Outlet } from 'react-router-dom'
|
|
|
import type { RouteObject } from 'react-router-dom'
|
|
import type { RouteObject } from 'react-router-dom'
|
|
|
import { useAuthStore } from '@/stores/authStore'
|
|
import { useAuthStore } from '@/stores/authStore'
|
|
|
import Login from '@/pages/Login'
|
|
import Login from '@/pages/Login'
|
|
|
|
|
+import { AppShell } from '@/components/AppShell'
|
|
|
|
|
+import Dashboard from '@/pages/Dashboard'
|
|
|
|
|
+import Collections from '@/pages/Collections'
|
|
|
|
|
+import Documents from '@/pages/Documents'
|
|
|
|
|
+import RagTester from '@/pages/RagTester'
|
|
|
|
|
+import Settings from '@/pages/Settings'
|
|
|
|
|
+import ProjectsAdmin from '@/pages/ProjectsAdmin'
|
|
|
|
|
+import KeysAdmin from '@/pages/KeysAdmin'
|
|
|
|
|
|
|
|
function ProtectedRoute() {
|
|
function ProtectedRoute() {
|
|
|
const loggedIn = useAuthStore((s) => s.loggedIn)
|
|
const loggedIn = useAuthStore((s) => s.loggedIn)
|
|
@@ -9,25 +17,10 @@ function ProtectedRoute() {
|
|
|
return <AppShell />
|
|
return <AppShell />
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// Minimal placeholder shell — replaced by the real AppShell in W4.
|
|
|
|
|
-function AppShell() {
|
|
|
|
|
- const logout = useAuthStore((s) => s.logout)
|
|
|
|
|
- return (
|
|
|
|
|
- <div className="min-h-screen bg-[#0b0f17] text-slate-100">
|
|
|
|
|
- <header className="flex items-center justify-between px-6 py-3 border-b border-slate-800">
|
|
|
|
|
- <span className="font-semibold text-slate-200">VectorAPI</span>
|
|
|
|
|
- <button
|
|
|
|
|
- onClick={() => logout()}
|
|
|
|
|
- className="text-sm text-slate-400 hover:text-slate-200 transition"
|
|
|
|
|
- >
|
|
|
|
|
- Sign out
|
|
|
|
|
- </button>
|
|
|
|
|
- </header>
|
|
|
|
|
- <main className="p-8">
|
|
|
|
|
- <Outlet />
|
|
|
|
|
- </main>
|
|
|
|
|
- </div>
|
|
|
|
|
- )
|
|
|
|
|
|
|
+function AdminRoute() {
|
|
|
|
|
+ const admin = useAuthStore((s) => s.admin)
|
|
|
|
|
+ if (!admin) return <Navigate to="/" replace />
|
|
|
|
|
+ return <Outlet />
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export const routes: RouteObject[] = [
|
|
export const routes: RouteObject[] = [
|
|
@@ -35,7 +28,18 @@ export const routes: RouteObject[] = [
|
|
|
{
|
|
{
|
|
|
element: <ProtectedRoute />,
|
|
element: <ProtectedRoute />,
|
|
|
children: [
|
|
children: [
|
|
|
- { index: true, element: <div className="text-xl text-slate-300">Dashboard — coming in W5</div> },
|
|
|
|
|
|
|
+ { index: true, element: <Dashboard /> },
|
|
|
|
|
+ { path: 'collections', element: <Collections /> },
|
|
|
|
|
+ { path: 'documents', element: <Documents /> },
|
|
|
|
|
+ { path: 'rag', element: <RagTester /> },
|
|
|
|
|
+ {
|
|
|
|
|
+ element: <AdminRoute />,
|
|
|
|
|
+ children: [
|
|
|
|
|
+ { path: 'settings', element: <Settings /> },
|
|
|
|
|
+ { path: 'projects', element: <ProjectsAdmin /> },
|
|
|
|
|
+ { path: 'keys', element: <KeysAdmin /> },
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
],
|
|
],
|
|
|
},
|
|
},
|
|
|
]
|
|
]
|