Files
condado-newsletter/frontend/src/router/index.tsx
Gabriel Sancho 6538c1783d feat(frontend): add task details edit flow
Add a task details action from the entity page and route it to a prefilled edit task page.

Extend the local task API with single-task read and update helpers, and cover the new flow with frontend tests.
2026-03-27 00:48:14 -03:00

85 lines
1.9 KiB
TypeScript

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 (
<Suspense fallback={<div>Loading...</div>}>
<ProtectedRoute>
<div className="min-h-screen bg-slate-950 text-slate-100">
<NavBar />
{children}
</div>
</ProtectedRoute>
</Suspense>
)
}
export const router = createBrowserRouter([
{
path: '/login',
element: (
<Suspense fallback={<div>Loading...</div>}>
<LoginPage />
</Suspense>
),
},
{
path: '/',
element: (
<Protected>
<DashboardPage />
</Protected>
),
},
{
path: '/entities',
element: (
<Protected>
<EntitiesPage />
</Protected>
),
},
{
path: '/entities/:entityId',
element: (
<Protected>
<EntityDetailPage />
</Protected>
),
},
{
path: '/entities/:entityId/tasks/new',
element: (
<Protected>
<CreateTaskPage />
</Protected>
),
},
{
path: '/entities/:entityId/tasks/:taskId',
element: (
<Protected>
<EditTaskPage />
</Protected>
),
},
{
path: '/logs',
element: (
<Protected>
<LogsPage />
</Protected>
),
},
])