Kairo-Jinkendo/frontend/src/pages/modes/WorkLayout.jsx
Lars c79bfa844f
Some checks failed
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Failing after 3m9s
Test Suite / k6 /api/health Baseline (push) Has been skipped
Test Suite / playwright-smoke (push) Has been skipped
Test Suite / lint-backend (push) Successful in 3s
Test Suite / compose-smoke (push) Has been skipped
AP2.3f: Restschuld ? uiFeatures, Route-Registry und slice-bewusste Mutationen.
Archetyp-Profile und Seitenlogik auf Operating Context migriert; methodUiDefaults nur noch Fallback.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 10:52:12 +02:00

55 lines
1.7 KiB
JavaScript

import { Navigate, Outlet } from 'react-router-dom'
import { useMemo } from 'react'
import { ModeAreaShell } from '../../components/ModeAreaShell.jsx'
import { ModeAreaNav } from '../../components/ModeAreaNav.jsx'
import { ModeShell } from '../../components/ModeShell.jsx'
import { WORK_NAV_ITEMS, resolveWorkNavActiveKey } from '../../config/workNav.js'
import { useProgramScope } from '../../context/ProgramScopeContext.jsx'
import { useMethodUiContext } from '../../hooks/useMethodUiContext.js'
import { resolveWorkNavItemsFromProfile } from '../../registry/resolveOperatingProfile.js'
function WorkAreaNav() {
const { initiativeId } = useProgramScope()
const { operatingContext, hasActiveSprint, loading } = useMethodUiContext()
const navItems = useMemo(() => {
if (!initiativeId) return WORK_NAV_ITEMS
if (loading && !operatingContext) return WORK_NAV_ITEMS
return resolveWorkNavItemsFromProfile({ operatingContext, hasActiveSprint })
}, [initiativeId, loading, operatingContext, hasActiveSprint])
return (
<ModeAreaNav
modeLabel="Ausführen"
items={navItems}
resolveActiveKey={resolveWorkNavActiveKey}
/>
)
}
export function WorkLayout() {
return (
<div className="app-page">
<ModeShell modeKey="work" />
<ModeAreaShell nav={<WorkAreaNav />}>
<Outlet />
</ModeAreaShell>
</div>
)
}
export function WorkIndexRedirect() {
const { initiativeId, hrefWithScope } = useProgramScope()
const { workDefaultRoute, loading, operatingContext } = useMethodUiContext()
if (!initiativeId) {
return <Navigate to="/work/today" replace />
}
if (loading && !operatingContext) {
return null
}
return <Navigate to={hrefWithScope(workDefaultRoute)} replace />
}