import { Routes, Route, Navigate } from 'react-router-dom' import { useAuth } from '@/contexts/AuthContext' import Login from '@/pages/Login' import Dashboard from '@/pages/Dashboard' import Collections from '@/pages/Collections' import Documents from '@/pages/Documents' import Views from '@/pages/Views' import Pages from '@/pages/Pages' import PageDisplay from '@/pages/PageDisplay' import PageBuilder from '@/components/PageBuilder' import DocumentForm from '@/pages/DocumentForm' import Users from '@/pages/Users' import Groups from '@/pages/Groups' import ApiKeys from '@/pages/ApiKeys' import Workspaces from '@/pages/Workspaces' import WorkspaceEdit from '@/pages/WorkspaceEdit' import LlmProviders from '@/pages/LlmProviders' import ChatPage from '@/pages/ChatPage' import Archives from '@/pages/Archives' import ProtectedRoute from '@/components/ProtectedRoute' import { DashboardLayout } from '@/components/layout' function App() { const { isAuthenticated, isLoading } = useAuth() // Show loading spinner while checking auth state if (isLoading) { return (

Loading...

) } return ( {/* Public routes */} ) : (
S

SmartBotic CRM

Manage your business smarter

Sign in
) } /> } /> {/* Protected routes with dashboard layout */} } > } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> {/* Catch-all redirect */} } />
) } export default App