All files router.tsx

71.42% Statements 5/7
100% Branches 0/0
50% Functions 2/4
80% Lines 4/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66                          70x   70x               70x     9x                                                                              
import { createHashRouter, Navigate } from 'react-router-dom'
import type { RouteObject } from 'react-router-dom'
import { AuthGuard } from '@/features/auth/AuthGuard'
import { AppLayout } from '@/layouts/AppLayout'
import { SettingsPage } from '@/features/settings/SettingsPage'
import { DashboardPage } from '@/features/dashboard/DashboardPage'
import { NotFoundPage } from '@/features/errors/NotFoundPage'
import { routes as repositoriesRoutes } from '@/features/repositories/routes'
import { routes as projectsRoutes } from '@/features/projects/routes'
import { routes as runsRoutes } from '@/features/runs/routes'
import { routes as pipelinesRoutes } from '@/features/pipelines/routes'
import { llmConfigRoutes } from '@/features/llm-configs/routes'
import { containerRegistryRoutes } from '@/features/container-registries/routes'
import { LazyLoader } from '@/shared/components/LazyLoader'
 
const featureRoutes: RouteObject[] = [
  ...llmConfigRoutes,
  ...containerRegistryRoutes,
  ...repositoriesRoutes,
  ...projectsRoutes,
  ...runsRoutes,
  ...pipelinesRoutes,
]
 
export const router = createHashRouter([
  {
    path: '/login',
    element: (
      <LazyLoader
        factory={() =>
          import('@/features/auth/LoginPage').then((m) => ({
            default: m.LoginPage,
          }))
        }
      />
    ),
  },
  {
    path: '/callback',
    element: (
      <LazyLoader
        factory={() =>
          import('@/features/auth/CallbackPage').then((m) => ({
            default: m.CallbackPage,
          }))
        }
      />
    ),
  },
  {
    path: '/',
    element: (
      <AuthGuard>
        <AppLayout />
      </AuthGuard>
    ),
    children: [
      { index: true, element: <DashboardPage /> },
      ...featureRoutes,
      { path: 'settings', element: <SettingsPage /> },
    ],
  },
  { path: '/404', element: <NotFoundPage /> },
  { path: '*', element: <Navigate to="/404" replace /> },
])