AP1.9a: Arbeitsmodi-Shell mit Scope, Objekt-Routen und Legacy-Redirects.
Deploy Development / deploy (push) Successful in 47s
Test Suite / pytest-backend (push) Failing after 1m46s
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 2s
Test Suite / compose-smoke (push) Has been skipped

Ersetzt die Vorhaben-Tab-Navigation durch Cockpit/Ausführen/Planen/Kontrolle/Team, Deep Links für APs/Projekte/Gates und Programm-Scope im Header.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-07-08 12:55:37 +02:00
1 parent 33831a8c2c
commit e42edd86fa
54 files changed
+2489 -150

No files matched your search

+20 -4
View File
@@ -12,8 +12,11 @@ import { TasksSection } from '../components/TasksSection.jsx'
import { ErrorState } from '../components/ErrorState.jsx'
import { LoadingState } from '../components/LoadingState.jsx'
import { useInitiativeOperations } from '../context/InitiativeOperationsContext.jsx'
import { useProgramScope } from '../context/ProgramScopeContext.jsx'
import { useCapabilities } from '../hooks/useCapabilities.js'
import { useActors } from '../hooks/useActors.js'
import { recordRecentObject } from '../utils/recentObjects.js'
import { actionPath, scopedPath } from '../utils/routes.js'
function ActionDetailBody({
action,
@@ -81,6 +84,7 @@ function ActionDetailBody({
function ActionDetailStandalone() {
const { actionId } = useParams()
const { applyFromAction } = useProgramScope()
const { capabilities } = useCapabilities()
const actorsState = useActors()
const [action, setAction] = useState(null)
@@ -98,6 +102,14 @@ function ActionDetailStandalone() {
try {
const actionData = await getAction(actionId)
setAction(actionData)
applyFromAction(actionData)
recordRecentObject({
type: 'action',
id: actionData.id,
title: actionData.title,
href: actionPath(actionData.id),
initiativeId: actionData.initiative_id,
})
const [snap, projectData, roadmapData] = await Promise.all([
getInitiativeSteeringSnapshot(actionData.initiative_id),
listInitiativeProjects(actionData.initiative_id).catch(() => []),
@@ -111,7 +123,7 @@ function ActionDetailStandalone() {
} finally {
setLoading(false)
}
}, [actionId])
}, [actionId, applyFromAction])
useEffect(() => {
load()
@@ -190,11 +202,15 @@ function ActionDetailStandalone() {
return (
<div className="app-page">
<nav className="breadcrumb">
<Link to="/workspace">Workspace</Link>
<Link to="/cockpit">Cockpit</Link>
<span aria-hidden="true"> / </span>
<Link to={`/initiatives/${action.initiative_id}`}>Vorhaben</Link>
<Link to={scopedPath('/control/status', { initiativeId: action.initiative_id })}>
Vorhaben
</Link>
<span aria-hidden="true"> / </span>
<Link to={`/initiatives/${action.initiative_id}/execution`}>Ausführung</Link>
<Link to={scopedPath('/work/today', { initiativeId: action.initiative_id })}>
Ausführen
</Link>
<span aria-hidden="true"> / </span>
<span>{action.title}</span>
</nav>
+2 -1
View File
@@ -10,6 +10,7 @@ import { ErrorState } from '../components/ErrorState.jsx'
import { LoadingState } from '../components/LoadingState.jsx'
import { useCapabilities } from '../hooks/useCapabilities.js'
import { useSession } from '../context/SessionContext.jsx'
import { scopedPath } from '../utils/routes.js'
export function InitiativesPage() {
const { context } = useSession()
@@ -105,7 +106,7 @@ export function InitiativesPage() {
{initiatives.map((item) => (
<li key={item.id} className="list-item card-list-item">
<div className="list-item-main">
<Link to={`/initiatives/${item.id}`} className="list-item-link">
<Link to={scopedPath('/control/status', { initiativeId: item.id })} className="list-item-link">
<strong>{item.title}</strong>
</Link>
{item.goal && <p className="list-item-desc">{item.goal}</p>}
+61
View File
@@ -0,0 +1,61 @@
import { Navigate, useParams, useSearchParams } from 'react-router-dom'
import { actionPath, gatePath, projectPath, scopedPath } from '../utils/routes.js'
export function WorkspaceRedirect() {
return <Navigate to="/cockpit" replace />
}
export function MyActionsRedirect() {
return <Navigate to="/work/mine" replace />
}
export function InitiativeRootRedirect() {
const { id } = useParams()
return <Navigate to={scopedPath('/control/status', { initiativeId: id })} replace />
}
export function InitiativePlanRedirect() {
const { id } = useParams()
return <Navigate to={scopedPath('/plan/gates', { initiativeId: id })} replace />
}
export function InitiativeExecutionRedirect() {
const { id } = useParams()
return <Navigate to={scopedPath('/plan/structure', { initiativeId: id })} replace />
}
export function InitiativeInboxRedirect() {
const { id } = useParams()
return <Navigate to={scopedPath('/plan/inbox', { initiativeId: id })} replace />
}
export function InitiativeJourneyRedirect() {
const { id } = useParams()
return <Navigate to={scopedPath('/control/journey', { initiativeId: id })} replace />
}
export function InitiativeGateRedirect() {
const { itemId } = useParams()
return <Navigate to={gatePath(itemId)} replace />
}
export function InitiativeProjectRedirect() {
const { projectId } = useParams()
return <Navigate to={projectPath(projectId)} replace />
}
export function InitiativeActionRedirect() {
const { actionId } = useParams()
return <Navigate to={actionPath(actionId)} replace />
}
export function ProjectNewRedirect() {
const [searchParams] = useSearchParams()
const initiativeId = searchParams.get('initiative') || ''
const parent = searchParams.get('parent') || ''
const params = new URLSearchParams()
if (initiativeId) params.set('initiative', initiativeId)
if (parent) params.set('parent', parent)
const qs = params.toString()
return <Navigate to={qs ? `/projects/new?${qs}` : '/projects/new'} replace />
}
+48 -24
View File
@@ -7,7 +7,7 @@ import { ErrorState } from '../components/ErrorState.jsx'
import { LoadingState } from '../components/LoadingState.jsx'
import { WidgetCard } from '../components/WidgetCard.jsx'
export function MyActionsPage() {
export function MyActionsPage({ embedded = false }) {
const [actions, setActions] = useState([])
const [loading, setLoading] = useState(true)
const [error, setError] = useState(null)
@@ -34,25 +34,41 @@ export function MyActionsPage() {
? actions.filter((a) => a.status !== 'done' && a.status !== 'discarded')
: actions
return (
<div className="app-page">
<header className="page-header">
<div>
<h1>Meine Maßnahmen</h1>
<p className="page-lead">Dir zugewiesene offene und blockierte Maßnahmen.</p>
const content = (
<>
{!embedded && (
<header className="page-header">
<div>
<h1>Meine Maßnahmen</h1>
<p className="page-lead">Dir zugewiesene offene und blockierte Maßnahmen.</p>
</div>
<label className="checkbox-label">
<input
type="checkbox"
checked={hideDone}
onChange={(e) => setHideDone(e.target.checked)}
/>
Erledigte ausblenden
</label>
</header>
)}
{embedded && (
<div className="section-header section-header--compact">
<h2>Meine Queue</h2>
<label className="checkbox-label">
<input
type="checkbox"
checked={hideDone}
onChange={(e) => setHideDone(e.target.checked)}
/>
Erledigte ausblenden
</label>
</div>
<label className="checkbox-label">
<input
type="checkbox"
checked={hideDone}
onChange={(e) => setHideDone(e.target.checked)}
/>
Erledigte ausblenden
</label>
</header>
)}
<WidgetCard
title="Zugewiesene Maßnahmen"
title={embedded ? undefined : 'Zugewiesene Maßnahmen'}
actions={
<button type="button" className="btn btn-ghost" onClick={load} disabled={loading}>
Aktualisieren
@@ -65,7 +81,7 @@ export function MyActionsPage() {
<ActionList
actions={visible}
showInitiative
getManageLink={(a) => `/initiatives/${a.initiative_id}`}
getManageLink={(a) => `/actions/${a.id}`}
empty={
<EmptyState message="Keine offenen Maßnahmen. Du kannst eine neue Maßnahme in einem Vorhaben anlegen." />
}
@@ -73,11 +89,19 @@ export function MyActionsPage() {
)}
</WidgetCard>
<p className="page-footer-link">
<Link to="/initiatives" className="link-inline">
Zu den Vorhaben →
</Link>
</p>
</div>
{!embedded && (
<p className="page-footer-link">
<Link to="/initiatives" className="link-inline">
Zum Vorhaben-Katalog →
</Link>
</p>
)}
</>
)
if (embedded) {
return content
}
return <div className="app-page">{content}</div>
}
@@ -1,4 +1,5 @@
import { Link } from 'react-router-dom'
import { scopedPath } from '../../utils/routes.js'
import { useInitiativeOperations } from '../../context/InitiativeOperationsContext.jsx'
import { SteeringSnapshotPanel } from '../../components/SteeringSnapshotPanel.jsx'
import { NextActionWidget } from '../../widgets/NextActionWidget.jsx'
@@ -60,7 +61,7 @@ export function InitiativeOverviewPage() {
<span>{counts.blockers_open} offene Blocker</span>
)}
</p>
<Link to={`/initiatives/${initiativeId}/execution`} className="btn btn-secondary btn-sm">
<Link to={scopedPath('/work/today', { initiativeId })} className="btn btn-secondary btn-sm">
Zur Ausführung
</Link>
</section>
@@ -1,10 +1,9 @@
import { useParams } from 'react-router-dom'
import { useInitiativeOperations } from '../../context/InitiativeOperationsContext.jsx'
import { RoadmapPlanSection } from '../../components/RoadmapPlanSection.jsx'
export function InitiativePlanPage() {
const { id } = useParams()
const {
initiativeId,
roadmapItems,
capabilities,
formBusy,
@@ -24,7 +23,7 @@ export function InitiativePlanPage() {
<>
{error && <p className="error">{error}</p>}
<RoadmapPlanSection
initiativeId={id}
initiativeId={initiativeId}
items={roadmapItems}
canManage={capabilities.has('kairo.milestone.manage')}
onCreate={handleCreateRoadmapItem}
@@ -6,6 +6,7 @@ import { EmptyState } from '../../components/EmptyState.jsx'
import { ErrorState } from '../../components/ErrorState.jsx'
import { gateTitleById } from '../../components/GateSelect.jsx'
import { useInitiativeOperations } from '../../context/InitiativeOperationsContext.jsx'
import { gatePath, projectPath, actionPath, scopedPath } from '../../utils/routes.js'
import {
buildProjectPath,
buildProjectsByParent,
@@ -65,7 +66,7 @@ function ProjectDetailView({
<dt>Gate</dt>
<dd>
{gateTitle ? (
<Link to={`/initiatives/${initiativeId}/plan/items/${project.roadmap_item_id}`}>
<Link to={gatePath(project.roadmap_item_id)}>
{gateTitle}
</Link>
) : (
@@ -96,7 +97,7 @@ function ProjectDetailView({
{index === path.length - 1 ? (
<strong>{node.title}</strong>
) : (
<Link to={`/initiatives/${initiativeId}/execution/projects/${node.id}`}>
<Link to={projectPath(node.id)}>
{node.title}
</Link>
)}
@@ -112,7 +113,7 @@ function ProjectDetailView({
<ul className="item-list">
{childProjects.map((child) => (
<li key={child.id} className="list-item card-list-item">
<Link to={`/initiatives/${initiativeId}/execution/projects/${child.id}`}>
<Link to={projectPath(child.id)}>
<strong>{child.title}</strong>
</Link>
<StatusBadge kind="project" status={child.status} />
@@ -136,7 +137,7 @@ function ProjectDetailView({
<ul className="item-list">
{linkedActions.map((action) => (
<li key={action.id} className="list-item card-list-item">
<Link to={`/initiatives/${initiativeId}/actions/${action.id}`}>
<Link to={actionPath(action.id)}>
<strong>{action.title}</strong>
</Link>
<StatusBadge kind="action" status={action.status} />
@@ -158,7 +159,7 @@ function ProjectDetailView({
{canManage && (
<Link
className="btn btn-secondary"
to={`/initiatives/${initiativeId}/execution/projects/new?parent=${project.id}`}
to={`${projectPath('new')}?initiative=${initiativeId}&parent=${project.id}`}
>
Unterprojekt
</Link>
@@ -212,7 +213,7 @@ export function ProjectDetailPage() {
setLocalError(null)
const created = await ops.handleCreateProject(payload)
if (created?.id) {
navigate(`/initiatives/${ops.initiativeId}/execution/projects/${created.id}`, { replace: true })
navigate(projectPath(created.id), { replace: true })
} else if (ops.error) {
setLocalError(ops.error)
}
@@ -233,7 +234,7 @@ export function ProjectDetailPage() {
setLocalError(null)
const ok = await ops.handleDeleteProject(project.id)
if (ok) {
navigate(`/initiatives/${ops.initiativeId}/execution`)
navigate(scopedPath('/plan/structure', { initiativeId: ops.initiativeId }))
} else if (ops.error) {
setLocalError(ops.error)
}
@@ -241,7 +242,7 @@ export function ProjectDetailPage() {
function handleFilter() {
if (project) ops.setSelectedProjectId(project.id)
navigate(`/initiatives/${ops.initiativeId}/execution`)
navigate(scopedPath('/plan/structure', { initiativeId: ops.initiativeId }))
}
const title = isNew ? 'Neues Projekt' : project?.title || 'Projekt'
@@ -249,7 +250,7 @@ export function ProjectDetailPage() {
return (
<section className="card project-detail-page">
<nav className="breadcrumb breadcrumb--inline">
<Link to={`/initiatives/${ops.initiativeId}/execution`}>Ausführung</Link>
<Link to={scopedPath('/plan/structure', { initiativeId: ops.initiativeId })}>Struktur</Link>
<span aria-hidden="true"> / </span>
<span>{title}</span>
</nav>
@@ -298,7 +299,7 @@ export function ProjectDetailPage() {
onSubmit={isNew ? handleCreate : handleUpdate}
onCancel={
isNew
? () => navigate(`/initiatives/${ops.initiativeId}/execution`)
? () => navigate(scopedPath('/plan/structure', { initiativeId: ops.initiativeId }))
: () => setEditing(false)
}
busy={ops.formBusy}
@@ -25,6 +25,8 @@ import {
ROADMAP_ITEM_TYPE_LABELS,
} from '../../constants/status.js'
import { useCapabilities } from '../../hooks/useCapabilities.js'
import { useInitiativeOperations } from '../../context/InitiativeOperationsContext.jsx'
import { scopedPath } from '../../utils/routes.js'
import { listGateContributions } from '../../api/journey.js'
import { GateContributionsSection } from '../../components/GateContributionsSection.jsx'
@@ -71,8 +73,11 @@ function CriterionDecisionForm({ label, onSubmit, busy }) {
)
}
export function RoadmapItemDetailPage() {
const { id: initiativeId, itemId } = useParams()
export function RoadmapItemDetailPage({ overrideItemId }) {
const { id: routeInitiativeId, itemId: routeItemId, gateId } = useParams()
const ops = useInitiativeOperations()
const initiativeId = routeInitiativeId || ops?.initiativeId
const itemId = overrideItemId || routeItemId || gateId
const { capabilities } = useCapabilities()
const canManage = capabilities.has('kairo.milestone.manage')
const canReopen = capabilities.has('kairo.roadmap.reopen')
@@ -152,7 +157,7 @@ export function RoadmapItemDetailPage() {
return (
<section className="card roadmap-item-detail">
<p className="breadcrumb muted">
<Link to={`/initiatives/${initiativeId}/plan`}>Zielzustände</Link>
<Link to={scopedPath('/plan/gates', { initiativeId })}>Zielzustände</Link>
{' · '}
{item.title}
</p>
+84
View File
@@ -0,0 +1,84 @@
import { useNavigate } from 'react-router-dom'
import { useState } from 'react'
import { Link } from 'react-router-dom'
import { useCapabilities } from '../../hooks/useCapabilities.js'
import { getWidgetsForArea } from '../../registry/widgetRegistry.js'
import { useSession } from '../../context/SessionContext.jsx'
import { InitiativeForm } from '../../components/InitiativeForm.jsx'
import { createInitiative } from '../../api/initiatives.js'
import { ModeShell } from '../../components/ModeShell.jsx'
import { initiativeCatalogPath } from '../../utils/routes.js'
export function CockpitPage() {
const navigate = useNavigate()
const { context } = useSession()
const { capabilities, hasCapability } = useCapabilities()
const widgets = getWidgetsForArea('workspace', capabilities)
const [showForm, setShowForm] = useState(false)
const [formBusy, setFormBusy] = useState(false)
const [formError, setFormError] = useState(null)
async function handleCreateInitiative(payload) {
setFormBusy(true)
setFormError(null)
try {
await createInitiative({
...payload,
owner_actor_id: context?.actor?.id,
})
setShowForm(false)
navigate(initiativeCatalogPath())
} catch (err) {
setFormError(err.message)
} finally {
setFormBusy(false)
}
}
return (
<div className="app-page">
<ModeShell
modeKey="cockpit"
actions={
hasCapability('kairo.initiative.manage') ? (
<button
type="button"
className="btn btn-primary btn-block-mobile"
onClick={() => setShowForm((v) => !v)}
>
{showForm ? 'Abbrechen' : 'Vorhaben anlegen'}
</button>
) : null
}
/>
{showForm && (
<section className="card inline-form-card">
<h2 className="card-title card-title--lg">Neues Vorhaben</h2>
{formError && <p className="error">{formError}</p>}
<InitiativeForm
onSubmit={handleCreateInitiative}
onCancel={() => setShowForm(false)}
busy={formBusy}
submitLabel="Vorhaben anlegen"
/>
</section>
)}
<div className="widget-grid">
{widgets.map((widget) => {
const Component = widget.component
return <Component key={widget.key} />
})}
</div>
{hasCapability('kairo.initiative.read') && (
<p className="page-footer-link">
<Link to={initiativeCatalogPath()} className="link-inline">
Zum Vorhaben-Katalog →
</Link>
</p>
)}
</div>
)
}
@@ -0,0 +1,13 @@
import { RequireInitiativeScope } from '../../components/RequireInitiativeScope.jsx'
import { ScopedInitiativeProvider } from '../../layout/ScopedInitiativeProvider.jsx'
import { InitiativeJourneyPage } from '../initiative/InitiativeJourneyPage.jsx'
export function ControlJourneyPage() {
return (
<RequireInitiativeScope lead="Journey ist vorhabenspezifisch.">
<ScopedInitiativeProvider>
<InitiativeJourneyPage />
</ScopedInitiativeProvider>
</RequireInitiativeScope>
)
}
@@ -0,0 +1,22 @@
import { Navigate, Outlet } from 'react-router-dom'
import { ModeShell } from '../../components/ModeShell.jsx'
import { ModeSubNav } from '../../components/ModeSubNav.jsx'
const CONTROL_NAV = [
{ to: '/control/status', label: 'Steuerung', end: true },
{ to: '/control/journey', label: 'Journey', end: true },
]
export function ControlLayout() {
return (
<div className="app-page">
<ModeShell modeKey="control" />
<ModeSubNav items={CONTROL_NAV} />
<Outlet />
</div>
)
}
export function ControlIndexRedirect() {
return <Navigate to="/control/status" replace />
}
@@ -0,0 +1,13 @@
import { RequireInitiativeScope } from '../../components/RequireInitiativeScope.jsx'
import { ScopedInitiativeProvider } from '../../layout/ScopedInitiativeProvider.jsx'
import { InitiativeOverviewPage } from '../initiative/InitiativeOverviewPage.jsx'
export function ControlStatusPage() {
return (
<RequireInitiativeScope lead="Steuerung und Lagebild brauchen ein Vorhaben im Scope.">
<ScopedInitiativeProvider>
<InitiativeOverviewPage />
</ScopedInitiativeProvider>
</RequireInitiativeScope>
)
}
@@ -0,0 +1,13 @@
import { RequireInitiativeScope } from '../../components/RequireInitiativeScope.jsx'
import { ScopedInitiativeProvider } from '../../layout/ScopedInitiativeProvider.jsx'
import { InitiativePlanPage } from '../initiative/InitiativePlanPage.jsx'
export function PlanGatesPage() {
return (
<RequireInitiativeScope lead="Gates und Roadmap gehören zu einem Vorhaben.">
<ScopedInitiativeProvider>
<InitiativePlanPage />
</ScopedInitiativeProvider>
</RequireInitiativeScope>
)
}
@@ -0,0 +1,13 @@
import { RequireInitiativeScope } from '../../components/RequireInitiativeScope.jsx'
import { ScopedInitiativeProvider } from '../../layout/ScopedInitiativeProvider.jsx'
import { InitiativeInboxPage } from '../initiative/InitiativeInboxPage.jsx'
export function PlanInboxPage() {
return (
<RequireInitiativeScope lead="Eingang und Triage sind vorhabenspezifisch.">
<ScopedInitiativeProvider>
<InitiativeInboxPage />
</ScopedInitiativeProvider>
</RequireInitiativeScope>
)
}
+23
View File
@@ -0,0 +1,23 @@
import { Navigate, Outlet } from 'react-router-dom'
import { ModeShell } from '../../components/ModeShell.jsx'
import { ModeSubNav } from '../../components/ModeSubNav.jsx'
const PLAN_NAV = [
{ to: '/plan/structure', label: 'Struktur', end: true },
{ to: '/plan/gates', label: 'Zielzustände', end: true },
{ to: '/plan/inbox', label: 'Eingang', end: true },
]
export function PlanLayout() {
return (
<div className="app-page">
<ModeShell modeKey="plan" />
<ModeSubNav items={PLAN_NAV} />
<Outlet />
</div>
)
}
export function PlanIndexRedirect() {
return <Navigate to="/plan/structure" replace />
}
@@ -0,0 +1,40 @@
import { RequireInitiativeScope } from '../../components/RequireInitiativeScope.jsx'
import { ScopedInitiativeProvider } from '../../layout/ScopedInitiativeProvider.jsx'
import { ProjectsSection } from '../../components/ProjectsSection.jsx'
import { useInitiativeOperations } from '../../context/InitiativeOperationsContext.jsx'
function PlanStructureInner() {
const {
initiativeId,
projects,
roadmapItems,
selectedProjectId,
setSelectedProjectId,
capabilities,
error,
} = useInitiativeOperations()
return (
<>
{error && <p className="error">{error}</p>}
<ProjectsSection
initiativeId={initiativeId}
projects={projects}
roadmapItems={roadmapItems}
selectedProjectId={selectedProjectId}
onSelectProject={setSelectedProjectId}
canManage={capabilities.has('kairo.project.manage')}
/>
</>
)
}
export function PlanStructurePage() {
return (
<RequireInitiativeScope lead="Projektstruktur hängt an einem Vorhaben — wähle den Scope oben oder hier.">
<ScopedInitiativeProvider>
<PlanStructureInner />
</ScopedInitiativeProvider>
</RequireInitiativeScope>
)
}
+65
View File
@@ -0,0 +1,65 @@
import { useEffect, useState } from 'react'
import { Link } from 'react-router-dom'
import { getActorWorkload } from '../../api/workspace.js'
import { ModeShell } from '../../components/ModeShell.jsx'
import { LoadingState } from '../../components/LoadingState.jsx'
import { ErrorState } from '../../components/ErrorState.jsx'
import { scopedPath } from '../../utils/routes.js'
export function TeamPage() {
const [rows, setRows] = useState(null)
const [error, setError] = useState(null)
useEffect(() => {
let cancelled = false
getActorWorkload()
.then((data) => {
if (!cancelled) setRows(data)
})
.catch((err) => {
if (!cancelled) setError(err.message)
})
return () => {
cancelled = true
}
}, [])
return (
<div className="app-page">
<ModeShell modeKey="team" />
{rows === null && !error && <LoadingState message="Lade Team-Auslastung …" />}
{error && <ErrorState message={error} />}
{rows && (
<section className="card">
<h2 className="card-title">Auslastung nach Actor</h2>
{rows.length === 0 ? (
<p className="muted">Keine Zuweisungen im Portfolio.</p>
) : (
<ul className="team-workload-list">
{rows.map((row) => (
<li key={row.actor_id} className="team-workload-list__item">
<div>
<strong>{row.actor_name || row.actor_id}</strong>
<span className="muted">
{' '}
· {row.open_actions ?? 0} offen
{(row.blocked_actions ?? 0) > 0
? ` · ${row.blocked_actions} blockiert`
: ''}
</span>
</div>
<Link to={scopedPath('/work/mine')} className="link-inline">
Queue ansehen
</Link>
</li>
))}
</ul>
)}
<p className="page-footer-link muted">
AP1.9b erweitert Team um Filter nach Vorhaben und direkte Zuweisungslinks.
</p>
</section>
)}
</div>
)
}
+22
View File
@@ -0,0 +1,22 @@
import { Navigate, Outlet } from 'react-router-dom'
import { ModeShell } from '../../components/ModeShell.jsx'
import { ModeSubNav } from '../../components/ModeSubNav.jsx'
const WORK_NAV = [
{ to: '/work/today', label: 'Heute', end: true },
{ to: '/work/mine', label: 'Meine Queue', end: true },
]
export function WorkLayout() {
return (
<div className="app-page">
<ModeShell modeKey="work" />
<ModeSubNav items={WORK_NAV} />
<Outlet />
</div>
)
}
export function WorkIndexRedirect() {
return <Navigate to="/work/today" replace />
}
@@ -0,0 +1,5 @@
import { MyActionsPage } from '../MyActionsPage.jsx'
export function WorkMinePage() {
return <MyActionsPage embedded />
}
@@ -0,0 +1,9 @@
import { WorkspaceTodayWidget } from '../../widgets/WorkspaceTodayWidget.jsx'
export function WorkTodayPage() {
return (
<section className="card">
<WorkspaceTodayWidget />
</section>
)
}
@@ -0,0 +1,70 @@
import { useEffect, useState } from 'react'
import { useParams } from 'react-router-dom'
import { getRoadmapItem } from '../../api/roadmap.js'
import { LoadingState } from '../../components/LoadingState.jsx'
import { ErrorState } from '../../components/ErrorState.jsx'
import { useProgramScope } from '../../context/ProgramScopeContext.jsx'
import { ScopedInitiativeProvider } from '../../layout/ScopedInitiativeProvider.jsx'
import { RoadmapItemDetailPage } from '../initiative/RoadmapItemDetailPage.jsx'
import { recordRecentObject } from '../../utils/recentObjects.js'
import { gatePath } from '../../utils/routes.js'
export function GateObjectPage() {
const { gateId } = useParams()
const { applyFromInitiative } = useProgramScope()
const [gate, setGate] = useState(null)
const [loading, setLoading] = useState(true)
const [error, setError] = useState(null)
useEffect(() => {
let cancelled = false
setLoading(true)
setError(null)
getRoadmapItem(gateId)
.then((data) => {
if (cancelled) return
setGate(data)
applyFromInitiative(data.initiative_id)
recordRecentObject({
type: 'gate',
id: data.id,
title: data.title,
href: gatePath(data.id),
initiativeId: data.initiative_id,
})
})
.catch((err) => {
if (!cancelled) setError(err.message)
})
.finally(() => {
if (!cancelled) setLoading(false)
})
return () => {
cancelled = true
}
}, [gateId, applyFromInitiative])
if (loading) {
return (
<div className="app-page">
<LoadingState message="Lade Gate …" />
</div>
)
}
if (error || !gate) {
return (
<div className="app-page">
<ErrorState message={error || 'Gate nicht gefunden.'} />
</div>
)
}
return (
<div className="app-page">
<ScopedInitiativeProvider initiativeId={gate.initiative_id}>
<RoadmapItemDetailPage overrideItemId={gateId} />
</ScopedInitiativeProvider>
</div>
)
}
@@ -0,0 +1,89 @@
import { useEffect, useState } from 'react'
import { useParams, useSearchParams } from 'react-router-dom'
import { getProject } from '../../api/projects.js'
import { LoadingState } from '../../components/LoadingState.jsx'
import { ErrorState } from '../../components/ErrorState.jsx'
import { useProgramScope } from '../../context/ProgramScopeContext.jsx'
import { ScopedInitiativeProvider } from '../../layout/ScopedInitiativeProvider.jsx'
import { ProjectDetailPage } from '../initiative/ProjectDetailPage.jsx'
import { recordRecentObject } from '../../utils/recentObjects.js'
import { projectPath } from '../../utils/routes.js'
export function ProjectObjectPage() {
const { projectId } = useParams()
const [searchParams] = useSearchParams()
const { initiativeId: scopeInitiativeId, applyFromInitiative, applyFromProject } =
useProgramScope()
const initiativeFromQuery = searchParams.get('initiative') || scopeInitiativeId
const [project, setProject] = useState(null)
const [loading, setLoading] = useState(true)
const [error, setError] = useState(null)
useEffect(() => {
if (projectId === 'new') {
if (initiativeFromQuery) applyFromInitiative(initiativeFromQuery)
setProject(null)
setLoading(false)
return
}
let cancelled = false
setLoading(true)
setError(null)
getProject(projectId)
.then((data) => {
if (cancelled) return
setProject(data)
applyFromProject(data)
recordRecentObject({
type: 'project',
id: data.id,
title: data.title,
href: projectPath(data.id),
initiativeId: data.initiative_id,
})
})
.catch((err) => {
if (!cancelled) setError(err.message)
})
.finally(() => {
if (!cancelled) setLoading(false)
})
return () => {
cancelled = true
}
}, [projectId, initiativeFromQuery, applyFromInitiative, applyFromProject])
if (loading) {
return (
<div className="app-page">
<LoadingState message="Lade Projekt …" />
</div>
)
}
if (error) {
return (
<div className="app-page">
<ErrorState message={error} />
</div>
)
}
const initiativeId = project?.initiative_id || initiativeFromQuery
if (projectId === 'new' && !initiativeId) {
return (
<div className="app-page">
<ErrorState message="Für ein neues Projekt braucht es ein Vorhaben im Scope (?initiative=)." />
</div>
)
}
return (
<div className="app-page">
<ScopedInitiativeProvider initiativeId={initiativeId}>
<ProjectDetailPage />
</ScopedInitiativeProvider>
</div>
)
}