import { createBrowserRouter } from 'react-router-dom' import { lazy, Suspense, ReactNode } from 'react' import ProtectedRoute from '../components/ProtectedRoute' import NavBar from '../components/NavBar' const LoginPage = lazy(() => import('../pages/LoginPage')) const DashboardPage = lazy(() => import('../pages/DashboardPage')) const EntitiesPage = lazy(() => import('../pages/EntitiesPage')) const EntityDetailPage = lazy(() => import('../pages/EntityDetailPage')) const CreateTaskPage = lazy(() => import('../pages/CreateTaskPage')) const EditTaskPage = lazy(() => import('../pages/EditTaskPage')) const LogsPage = lazy(() => import('../pages/LogsPage')) function Protected({ children }: { children: ReactNode }) { return ( Loading...}>
{children}
) } export const router = createBrowserRouter([ { path: '/login', element: ( Loading...}> ), }, { path: '/', element: ( ), }, { path: '/entities', element: ( ), }, { path: '/entities/:entityId', element: ( ), }, { path: '/entities/:entityId/tasks/new', element: ( ), }, { path: '/entities/:entityId/tasks/:taskId', element: ( ), }, { path: '/logs', element: ( ), }, ])