import { Navigate, Outlet } from 'react-router-dom' import type { RouteObject } from 'react-router-dom' import { useAuthStore } from '@/stores/authStore' 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() { const loggedIn = useAuthStore((s) => s.loggedIn) if (!loggedIn) return return } function AdminRoute() { const admin = useAuthStore((s) => s.admin) if (!admin) return return } export const routes: RouteObject[] = [ { path: '/login', element: }, { element: , children: [ { index: true, element: }, { path: 'collections', element: }, { path: 'documents', element: }, { path: 'rag', element: }, { element: , children: [ { path: 'settings', element: }, { path: 'projects', element: }, { path: 'keys', element: }, ], }, ], }, ]