2026-07-08 12:55:37 +02:00
|
|
|
import { Navigate, Route, Routes } from 'react-router-dom'
|
2026-07-05 06:41:23 +02:00
|
|
|
import { SessionProvider, useSession } from './context/SessionContext.jsx'
|
2026-07-08 12:55:37 +02:00
|
|
|
import { ProgramScopeProvider } from './context/ProgramScopeContext.jsx'
|
2026-07-05 06:41:23 +02:00
|
|
|
import { AppLayout } from './layout/AppLayout.jsx'
|
|
|
|
|
import { AuthPanel } from './pages/AuthPanel.jsx'
|
2026-07-05 18:29:47 +02:00
|
|
|
import { ActionDetailPage } from './pages/ActionDetailPage.jsx'
|
2026-07-08 12:55:37 +02:00
|
|
|
import { ProjectObjectPage } from './pages/objects/ProjectObjectPage.jsx'
|
|
|
|
|
import { GateObjectPage } from './pages/objects/GateObjectPage.jsx'
|
|
|
|
|
import {
|
|
|
|
|
VIEWS,
|
|
|
|
|
WorkLayout,
|
|
|
|
|
WorkIndexRedirect,
|
|
|
|
|
PlanLayout,
|
|
|
|
|
PlanIndexRedirect,
|
|
|
|
|
ControlLayout,
|
|
|
|
|
ControlIndexRedirect,
|
|
|
|
|
MODE_ROUTE_COMPONENTS,
|
|
|
|
|
} from './registry/viewRegistry.js'
|
|
|
|
|
import {
|
|
|
|
|
WorkspaceRedirect,
|
|
|
|
|
MyActionsRedirect,
|
|
|
|
|
InitiativeRootRedirect,
|
|
|
|
|
InitiativePlanRedirect,
|
|
|
|
|
InitiativeExecutionRedirect,
|
|
|
|
|
InitiativeInboxRedirect,
|
|
|
|
|
InitiativeJourneyRedirect,
|
|
|
|
|
InitiativeGateRedirect,
|
|
|
|
|
InitiativeProjectRedirect,
|
|
|
|
|
InitiativeActionRedirect,
|
|
|
|
|
} from './pages/LegacyRedirects.jsx'
|
2026-07-05 06:41:23 +02:00
|
|
|
import './app.css'
|
|
|
|
|
|
|
|
|
|
function AppRoutes() {
|
|
|
|
|
const { isAuthenticated, loading } = useSession()
|
|
|
|
|
|
|
|
|
|
if (loading) {
|
|
|
|
|
return null
|
2026-07-04 20:17:03 +02:00
|
|
|
}
|
|
|
|
|
|
2026-07-05 06:41:23 +02:00
|
|
|
if (!isAuthenticated) {
|
|
|
|
|
return <AuthPanel />
|
2026-07-04 20:17:03 +02:00
|
|
|
}
|
|
|
|
|
|
2026-07-08 12:55:37 +02:00
|
|
|
const topLevelViews = VIEWS.filter(
|
|
|
|
|
(v) =>
|
|
|
|
|
![
|
|
|
|
|
'kairo.workspace',
|
|
|
|
|
'kairo.my_actions',
|
|
|
|
|
'kairo.work',
|
|
|
|
|
'kairo.plan',
|
|
|
|
|
'kairo.control',
|
|
|
|
|
].includes(v.key),
|
|
|
|
|
)
|
2026-07-05 18:29:47 +02:00
|
|
|
|
2026-07-04 19:15:43 +02:00
|
|
|
return (
|
2026-07-08 12:55:37 +02:00
|
|
|
<ProgramScopeProvider>
|
|
|
|
|
<Routes>
|
|
|
|
|
<Route element={<AppLayout />}>
|
|
|
|
|
{topLevelViews.map((view) => (
|
|
|
|
|
<Route key={view.key} path={view.path} element={<view.component />} />
|
|
|
|
|
))}
|
|
|
|
|
|
|
|
|
|
<Route path="/work" element={<WorkLayout />}>
|
|
|
|
|
<Route index element={<WorkIndexRedirect />} />
|
|
|
|
|
<Route path="today" element={<MODE_ROUTE_COMPONENTS.workToday />} />
|
2026-07-12 16:27:34 +02:00
|
|
|
<Route path="sprint" element={<MODE_ROUTE_COMPONENTS.workSprint />} />
|
2026-07-08 12:55:37 +02:00
|
|
|
<Route path="mine" element={<MODE_ROUTE_COMPONENTS.workMine />} />
|
|
|
|
|
</Route>
|
|
|
|
|
|
|
|
|
|
<Route path="/plan" element={<PlanLayout />}>
|
|
|
|
|
<Route index element={<PlanIndexRedirect />} />
|
2026-07-09 11:16:42 +02:00
|
|
|
<Route path="portfolio" element={<MODE_ROUTE_COMPONENTS.planPortfolio />} />
|
|
|
|
|
<Route path="profile" element={<MODE_ROUTE_COMPONENTS.planProfile />} />
|
2026-07-08 12:55:37 +02:00
|
|
|
<Route path="structure" element={<MODE_ROUTE_COMPONENTS.planStructure />} />
|
|
|
|
|
<Route path="gates" element={<MODE_ROUTE_COMPONENTS.planGates />} />
|
|
|
|
|
<Route path="inbox" element={<MODE_ROUTE_COMPONENTS.planInbox />} />
|
2026-07-12 16:27:34 +02:00
|
|
|
<Route path="sprint" element={<MODE_ROUTE_COMPONENTS.planSprint />} />
|
2026-07-09 11:38:17 +02:00
|
|
|
<Route path="work" element={<MODE_ROUTE_COMPONENTS.planWork />} />
|
2026-07-08 12:55:37 +02:00
|
|
|
</Route>
|
|
|
|
|
|
|
|
|
|
<Route path="/control" element={<ControlLayout />}>
|
|
|
|
|
<Route index element={<ControlIndexRedirect />} />
|
|
|
|
|
<Route path="status" element={<MODE_ROUTE_COMPONENTS.controlStatus />} />
|
2026-07-11 08:10:15 +02:00
|
|
|
<Route path="plan-ist" element={<MODE_ROUTE_COMPONENTS.controlPlanIst />} />
|
2026-07-08 12:55:37 +02:00
|
|
|
<Route path="journey" element={<MODE_ROUTE_COMPONENTS.controlJourney />} />
|
|
|
|
|
</Route>
|
|
|
|
|
|
|
|
|
|
<Route path="/projects/:projectId" element={<ProjectObjectPage />} />
|
|
|
|
|
<Route path="/gates/:gateId" element={<GateObjectPage />} />
|
|
|
|
|
<Route path="/actions/:actionId" element={<ActionDetailPage />} />
|
|
|
|
|
|
|
|
|
|
<Route path="/workspace" element={<WorkspaceRedirect />} />
|
|
|
|
|
<Route path="/my-actions" element={<MyActionsRedirect />} />
|
|
|
|
|
|
|
|
|
|
<Route path="/initiatives/:id" element={<InitiativeRootRedirect />} />
|
|
|
|
|
<Route path="/initiatives/:id/plan" element={<InitiativePlanRedirect />} />
|
|
|
|
|
<Route path="/initiatives/:id/plan/items/:itemId" element={<InitiativeGateRedirect />} />
|
|
|
|
|
<Route path="/initiatives/:id/execution" element={<InitiativeExecutionRedirect />} />
|
|
|
|
|
<Route
|
|
|
|
|
path="/initiatives/:id/execution/projects/:projectId"
|
|
|
|
|
element={<InitiativeProjectRedirect />}
|
|
|
|
|
/>
|
|
|
|
|
<Route path="/initiatives/:id/inbox" element={<InitiativeInboxRedirect />} />
|
|
|
|
|
<Route path="/initiatives/:id/journey" element={<InitiativeJourneyRedirect />} />
|
|
|
|
|
<Route path="/initiatives/:id/actions/:actionId" element={<InitiativeActionRedirect />} />
|
|
|
|
|
<Route path="/initiatives/:id/detail" element={<InitiativeRootRedirect />} />
|
|
|
|
|
|
|
|
|
|
<Route path="/" element={<Navigate to="/cockpit" replace />} />
|
|
|
|
|
<Route path="*" element={<Navigate to="/cockpit" replace />} />
|
2026-07-05 18:29:47 +02:00
|
|
|
</Route>
|
2026-07-08 12:55:37 +02:00
|
|
|
</Routes>
|
|
|
|
|
</ProgramScopeProvider>
|
2026-07-05 06:41:23 +02:00
|
|
|
)
|
|
|
|
|
}
|
2026-07-04 20:19:02 +02:00
|
|
|
|
2026-07-05 06:41:23 +02:00
|
|
|
export default function App() {
|
|
|
|
|
return (
|
|
|
|
|
<SessionProvider>
|
|
|
|
|
<AppRoutes />
|
|
|
|
|
</SessionProvider>
|
2026-07-04 19:15:43 +02:00
|
|
|
)
|
|
|
|
|
}
|