AP1.1b: Vorhaben-Detail als Steuerungsfläche — Action-Hub statt paralleler Listen
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Successful in 1m26s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 18s
Test Suite / playwright-smoke (push) Successful in 12s

Leitfrage oben, Maßnahmen mit verknüpftem Kontext aus dem Snapshot, vollständiges Meilenstein-Formular, Backlog/Entscheidungen/Nachweise unter Erweitert. Version 0.11.2-ap1.1b.
This commit is contained in:
Lars committed 2026-07-05 17:39:18 +02:00
1 parent fc956d4ceb
commit a520d54bcf
10 files changed
+852 -314

No files matched your search

+173
View File
@@ -0,0 +1,173 @@
import { ACTION_STATUSES, ACTION_STATUS_LABELS } from '../constants/status.js'
import { StatusBadge } from './StatusBadge.jsx'
import { PriorityBadge } from './PriorityBadge.jsx'
import { ActionForm } from './ActionForm.jsx'
function formatDue(iso) {
if (!iso) return null
try {
return new Date(iso).toLocaleString('de-DE', {
day: '2-digit',
month: '2-digit',
year: 'numeric',
hour: '2-digit',
minute: '2-digit',
})
} catch {
return iso
}
}
function LinkedItems({ title, items, renderItem }) {
if (!items?.length) return null
return (
<div className="action-hub-linked">
<h4 className="action-hub-linked-title">{title}</h4>
<ul className="action-hub-linked-list">
{items.map((item) => (
<li key={item.id}>{renderItem(item)}</li>
))}
</ul>
</div>
)
}
export function ActionHubCard({
action,
context,
editing,
onEdit,
onCancelEdit,
onSubmitEdit,
onQuickStatus,
onCreateBlocker,
canManage,
canManageBlocker,
formBusy,
actors,
actorsLoading,
actorsError,
actorsUsedFallback,
onReloadActors,
}) {
const due = formatDue(action.due_at)
const isBlocked = action.status === 'blocked' || context?.has_open_blocker
if (editing) {
return (
<article className="action-hub-card action-hub-card--editing">
<ActionForm
initial={action}
actors={actors}
actorsLoading={actorsLoading}
actorsError={actorsError}
actorsUsedFallback={actorsUsedFallback}
onReloadActors={onReloadActors}
onSubmit={onSubmitEdit}
onCancel={onCancelEdit}
busy={formBusy}
submitLabel="Speichern"
/>
</article>
)
}
return (
<article
className={`action-hub-card${isBlocked ? ' action-hub-card--blocked' : ''}`}
>
<header className="action-hub-card-header">
<div className="action-hub-card-title-row">
<h3 className="action-hub-card-title">{action.title}</h3>
<div className="action-hub-card-badges">
<StatusBadge status={action.status} />
<PriorityBadge priority={action.priority} />
</div>
</div>
{action.description && (
<p className="action-hub-card-desc">{action.description}</p>
)}
<div className="action-hub-card-meta muted">
{action.assigned_actor_ids?.length > 0 && (
<span>{action.assigned_actor_ids.length} zugewiesen</span>
)}
{due && <span>Fällig: {due}</span>}
</div>
</header>
{context && (
<>
<LinkedItems
title="Blocker"
items={context.blockers?.filter((b) =>
['open', 'in_progress'].includes(b.status)
)}
renderItem={(b) => (
<>
<StatusBadge kind="blocker" status={b.status} />
<strong>{b.title}</strong>
</>
)}
/>
<LinkedItems
title="Nachweise"
items={context.evidence}
renderItem={(e) => (
<>
<StatusBadge kind="evidence" status={e.status} />
{e.title}
</>
)}
/>
<LinkedItems
title="Reviews"
items={context.reviews}
renderItem={(r) => (
<>
<StatusBadge kind="review" status={r.status} />
{r.title}
{r.due_at && (
<span className="muted"> · fällig {formatDue(r.due_at)}</span>
)}
</>
)}
/>
</>
)}
{canManage && (
<footer className="action-hub-card-actions">
<select
className="inline-select"
value={action.status}
onChange={(e) => onQuickStatus(e.target.value)}
aria-label="Status ändern"
>
{ACTION_STATUSES.map((s) => (
<option key={s} value={s}>
{ACTION_STATUS_LABELS[s]}
</option>
))}
</select>
{canManageBlocker && action.status !== 'done' && (
<button
type="button"
className="btn btn-secondary btn-sm"
onClick={onCreateBlocker}
disabled={formBusy}
>
Blocker melden
</button>
)}
<button
type="button"
className="btn btn-ghost btn-sm"
onClick={onEdit}
>
Bearbeiten
</button>
</footer>
)}
</article>
)
}
+14 -8
View File
@@ -13,22 +13,28 @@ export function BlockersSection({
onUpdateStatus,
onDelete,
busy,
heading = 'Blocker',
lead = null,
emptyMessage = 'Keine Blocker.',
}) {
const [title, setTitle] = useState('')
const [formTitle, setFormTitle] = useState('')
const [showForm, setShowForm] = useState(false)
async function handleSubmit(e) {
e.preventDefault()
if (!title.trim()) return
await onCreate({ title: title.trim() })
setTitle('')
if (!formTitle.trim()) return
await onCreate({ title: formTitle.trim() })
setFormTitle('')
setShowForm(false)
}
return (
<section className="card">
<div className="section-header">
<h2>Blocker</h2>
<div>
<h2>{heading}</h2>
{lead && <p className="section-lead muted">{lead}</p>}
</div>
{canManage && (
<button
type="button"
@@ -45,8 +51,8 @@ export function BlockersSection({
<label>
Titel
<input
value={title}
onChange={(e) => setTitle(e.target.value)}
value={formTitle}
onChange={(e) => setFormTitle(e.target.value)}
maxLength={255}
required
/>
@@ -57,7 +63,7 @@ export function BlockersSection({
</form>
)}
{blockers.length === 0 && <EmptyState message="Keine Blocker." />}
{blockers.length === 0 && <EmptyState message={emptyMessage} />}
<ul className="item-list">
{blockers.map((blocker) => (
@@ -0,0 +1,29 @@
import { useState } from 'react'
export function CollapsibleSection({
title,
summary,
defaultOpen = false,
children,
className = '',
}) {
const [open, setOpen] = useState(defaultOpen)
return (
<section className={`collapsible-section card ${className}`.trim()}>
<button
type="button"
className="collapsible-section-trigger"
onClick={() => setOpen((v) => !v)}
aria-expanded={open}
>
<span className="collapsible-section-title">{title}</span>
{summary && <span className="collapsible-section-summary muted">{summary}</span>}
<span className="collapsible-section-chevron" aria-hidden="true">
{open ? '▾' : '▸'}
</span>
</button>
{open && <div className="collapsible-section-body">{children}</div>}
</section>
)
}
@@ -0,0 +1,103 @@
import { ActionHubCard } from './ActionHubCard.jsx'
import { ActionForm } from './ActionForm.jsx'
import { EmptyState } from './EmptyState.jsx'
export function InitiativeActionsHub({
actions,
actionContextById,
hideDone,
onHideDoneChange,
showForm,
onToggleForm,
editingActionId,
onEditAction,
onCancelEdit,
onCreateAction,
onUpdateAction,
onQuickStatus,
onCreateBlockerForAction,
canManage,
canManageBlocker,
formBusy,
actors,
actorsLoading,
actorsError,
actorsUsedFallback,
onReloadActors,
}) {
return (
<section className="card initiative-actions-hub">
<div className="section-header">
<div>
<h2>Maßnahmen — operative Arbeit</h2>
<p className="section-lead muted">
Blocker, Nachweise und Reviews hängen an der Maßnahme, nicht lose im Vorhaben.
</p>
</div>
<div className="section-actions">
<label className="checkbox-label inline-filter">
<input
type="checkbox"
checked={hideDone}
onChange={(e) => onHideDoneChange(e.target.checked)}
/>
Erledigte ausblenden
</label>
{canManage && (
<button
type="button"
className="btn btn-primary btn-block-mobile"
onClick={onToggleForm}
>
{showForm ? 'Abbrechen' : 'Maßnahme anlegen'}
</button>
)}
</div>
</div>
{showForm && canManage && (
<div className="inline-form-block">
<ActionForm
actors={actors}
actorsLoading={actorsLoading}
actorsError={actorsError}
actorsUsedFallback={actorsUsedFallback}
onReloadActors={onReloadActors}
onSubmit={onCreateAction}
onCancel={onToggleForm}
busy={formBusy}
submitLabel="Maßnahme anlegen"
/>
</div>
)}
{actions.length === 0 && (
<EmptyState message="Noch keine Maßnahmen — lege die erste operative Maßnahme an oder wandle Backlog um." />
)}
<div className="action-hub-grid">
{actions.map((action) => (
<ActionHubCard
key={action.id}
action={action}
context={actionContextById[action.id]}
editing={editingActionId === action.id}
onEdit={() => onEditAction(action.id)}
onCancelEdit={onCancelEdit}
onSubmitEdit={(payload) => onUpdateAction(action.id, payload)}
onQuickStatus={(status) => onQuickStatus(action, status)}
onCreateBlocker={() => onCreateBlockerForAction(action.id)}
canManage={canManage}
canManageBlocker={canManageBlocker}
formBusy={formBusy}
actors={actors}
actorsLoading={actorsLoading}
actorsError={actorsError}
actorsUsedFallback={actorsUsedFallback}
onReloadActors={onReloadActors}
/>
))}
</div>
</section>
)
}
+55 -8
View File
@@ -6,6 +6,17 @@ import {
import { StatusBadge } from './StatusBadge.jsx'
import { EmptyState } from './EmptyState.jsx'
function formatDate(value) {
if (!value) return null
try {
return new Date(value.includes('T') ? value : `${value}T12:00:00`).toLocaleDateString(
'de-DE'
)
} catch {
return value
}
}
export function MilestonesSection({
milestones,
canManage,
@@ -13,22 +24,36 @@ export function MilestonesSection({
onUpdateStatus,
onDelete,
busy,
compact = false,
}) {
const [title, setTitle] = useState('')
const [goalDescription, setGoalDescription] = useState('')
const [targetDate, setTargetDate] = useState('')
const [showForm, setShowForm] = useState(false)
async function handleSubmit(e) {
e.preventDefault()
if (!title.trim()) return
await onCreate({ title: title.trim() })
await onCreate({
title: title.trim(),
goal_description: goalDescription.trim(),
target_date: targetDate || undefined,
})
setTitle('')
setGoalDescription('')
setTargetDate('')
setShowForm(false)
}
return (
<section className="card">
<section className={`card${compact ? ' card--secondary' : ''}`}>
<div className="section-header">
<h2>Meilensteine</h2>
<div>
<h2>Meilensteine</h2>
<p className="section-lead muted">
Überprüfbare Zielpunkte — kein Task. Ziel und Termin machen den Horizont steuerbar.
</p>
</div>
{canManage && (
<button
type="button"
@@ -41,7 +66,7 @@ export function MilestonesSection({
</div>
{showForm && canManage && (
<form className="inline-form-block" onSubmit={handleSubmit}>
<form className="inline-form-block milestone-form" onSubmit={handleSubmit}>
<label>
Titel
<input
@@ -49,6 +74,24 @@ export function MilestonesSection({
onChange={(e) => setTitle(e.target.value)}
maxLength={255}
required
placeholder="z. B. MVP nutzbar im Alltag"
/>
</label>
<label>
Ziel / Definition of Done
<textarea
value={goalDescription}
onChange={(e) => setGoalDescription(e.target.value)}
rows={3}
placeholder="Woran erkennst du, dass dieser Meilenstein erreicht ist?"
/>
</label>
<label>
Zieltermin
<input
type="date"
value={targetDate}
onChange={(e) => setTargetDate(e.target.value)}
/>
</label>
<button type="submit" className="btn btn-primary" disabled={busy}>
@@ -57,18 +100,22 @@ export function MilestonesSection({
</form>
)}
{milestones.length === 0 && <EmptyState message="Keine Meilensteine." />}
{milestones.length === 0 && (
<EmptyState message="Noch keine Meilensteine — strukturiere das Vorhaben in überprüfbare Zielpunkte." />
)}
<ul className="item-list">
<ul className="item-list milestone-list">
{milestones.map((milestone) => (
<li key={milestone.id} className="list-item card-list-item">
<li key={milestone.id} className="list-item card-list-item milestone-list-item">
<div className="list-item-main">
<strong>{milestone.title}</strong>
{milestone.goal_description && (
<p className="list-item-desc">{milestone.goal_description}</p>
)}
{milestone.target_date && (
<p className="muted list-item-sub">Ziel: {milestone.target_date}</p>
<p className="muted list-item-sub">
Zieltermin: {formatDate(milestone.target_date)}
</p>
)}
</div>
<div className="list-item-meta action-controls">
+101 -95
View File
@@ -1,4 +1,3 @@
import { Link } from 'react-router-dom'
import {
LIFECYCLE_LABELS,
PHASE_LABELS,
@@ -69,35 +68,63 @@ export function SteeringSnapshotPanel({
? null
: PHASE_DESCRIPTIONS[operating_phase] || ''
return (
<section className="card steering-snapshot">
<div className="section-header">
<h2>Steuerungszustand</h2>
<span className="badge status-badge status-active">{displayLabel}</span>
</div>
const statPills = [
{ label: 'Offen', value: counts.actions_open, warn: false },
{ label: 'Blockiert', value: counts.actions_blocked, warn: counts.actions_blocked > 0 },
{ label: 'Review', value: counts.actions_review_required, warn: counts.actions_review_required > 0 },
{ label: 'Blocker', value: counts.blockers_open, warn: counts.blockers_open > 0 },
]
{(method_label || canManageMethod) && (
<p className="steering-method-row">
<span className="muted">Methode: </span>
{canManageMethod && methods.length > 0 ? (
<select
className="inline-select steering-method-select"
value={method_key || 'generic_operating'}
disabled={methodBusy}
onChange={(e) => onMethodChange?.(e.target.value)}
aria-label="Steuerungsmethode"
return (
<section className="card steering-snapshot steering-snapshot--hero">
<header className="steering-hero-header">
<div>
<p className="steering-hero-kicker">Leitfrage</p>
<h2 className="steering-hero-title">
Wo stehe ich — und was ist als Nächstes dran?
</h2>
</div>
<span className="badge status-badge status-active steering-lifecycle-badge">
{displayLabel}
</span>
</header>
<div className="steering-hero-toolbar">
{(method_label || canManageMethod) && (
<p className="steering-method-row">
<span className="muted">Methode: </span>
{canManageMethod && methods.length > 0 ? (
<select
className="inline-select steering-method-select"
value={method_key || 'generic_operating'}
disabled={methodBusy}
onChange={(e) => onMethodChange?.(e.target.value)}
aria-label="Steuerungsmethode"
>
{methods.map((m) => (
<option key={m.key} value={m.key}>
{m.label}
</option>
))}
</select>
) : (
<strong>{method_label || method_key}</strong>
)}
</p>
)}
<ul className="steering-stat-pills" aria-label="Kurzüberblick">
{statPills.map((pill) => (
<li
key={pill.label}
className={`steering-stat-pill${pill.warn ? ' steering-stat-pill--warn' : ''}`}
>
{methods.map((m) => (
<option key={m.key} value={m.key}>
{m.label}
</option>
))}
</select>
) : (
<strong>{method_label || method_key}</strong>
)}
</p>
)}
<span className="steering-stat-pill-value">{pill.value}</span>
<span className="steering-stat-pill-label">{pill.label}</span>
</li>
))}
</ul>
</div>
{phaseDesc && <p className="steering-phase-desc">{phaseDesc}</p>}
@@ -107,76 +134,55 @@ export function SteeringSnapshotPanel({
</p>
)}
{next_actions.length > 0 && (
<div className="steering-next-actions">
<h3>Nächste Schritte für dieses Vorhaben</h3>
<ol className="item-list compact-list">
{next_actions.map((item, i) => (
<li key={`${item.kind}-${i}`} className="list-item card-list-item compact">
<div className="list-item-main">
<span className="next-action-rank">{i + 1}</span>
<strong>{item.title}</strong>
<span className="muted list-item-sub">
{NEXT_ACTION_KIND_LABELS[item.kind] || item.kind}
{item.recommended_action ? ` — ${item.recommended_action}` : ''}
</span>
</div>
</li>
))}
</ol>
</div>
)}
{upcoming_milestones.length > 0 && (
<div className="steering-milestones">
<h3>Meilenstein-Horizont</h3>
<ul className="item-list compact-list">
{upcoming_milestones.map((ms) => (
<li key={ms.id} className="list-item card-list-item compact">
<div className="list-item-main">
<strong>{ms.title}</strong>
<span className="muted list-item-sub">
{MILESTONE_STATUS_LABELS[ms.status] || ms.status}
{ms.target_date ? ` · Ziel: ${formatDate(ms.target_date)}` : ''}
</span>
</div>
</li>
))}
</ul>
</div>
)}
<dl className="snapshot-counts">
<div>
<dt>Offene Maßnahmen</dt>
<dd>{counts.actions_open}</dd>
</div>
<div>
<dt>Blockiert</dt>
<dd>{counts.actions_blocked}</dd>
</div>
<div>
<dt>Review nötig</dt>
<dd>{counts.actions_review_required}</dd>
</div>
<div>
<dt>Offene Blocker</dt>
<dd>{counts.blockers_open}</dd>
</div>
{(counts.unlinked_blockers > 0 || counts.unlinked_evidence > 0) && (
<div className="snapshot-warn">
<dt>Unverknüpft</dt>
<dd>
{counts.unlinked_blockers} Blocker, {counts.unlinked_evidence} Evidence
</dd>
<div className="steering-hero-columns">
{next_actions.length > 0 && (
<div className="steering-next-actions">
<h3>Nächste Schritte</h3>
<ol className="item-list compact-list">
{next_actions.map((item, i) => (
<li key={`${item.kind}-${i}`} className="list-item card-list-item compact">
<div className="list-item-main">
<span className="next-action-rank">{i + 1}</span>
<strong>{item.title}</strong>
<span className="muted list-item-sub">
{NEXT_ACTION_KIND_LABELS[item.kind] || item.kind}
{item.recommended_action ? ` — ${item.recommended_action}` : ''}
</span>
</div>
</li>
))}
</ol>
</div>
)}
</dl>
<p className="muted snapshot-hint">
Steuerungszustand über Standard Lifecycle
{lifecycle_state ? ` (${lifecycle_state})` : ''}.
</p>
{upcoming_milestones.length > 0 && (
<div className="steering-milestones">
<h3>Meilenstein-Horizont</h3>
<ul className="item-list compact-list">
{upcoming_milestones.map((ms) => (
<li key={ms.id} className="list-item card-list-item compact">
<div className="list-item-main">
<strong>{ms.title}</strong>
<span className="muted list-item-sub">
{MILESTONE_STATUS_LABELS[ms.status] || ms.status}
{ms.target_date ? ` · Ziel: ${formatDate(ms.target_date)}` : ''}
</span>
</div>
</li>
))}
</ul>
</div>
)}
</div>
{(counts.unlinked_blockers > 0 || counts.unlinked_evidence > 0) && (
<p className="steering-unlinked-hint muted">
{counts.unlinked_blockers > 0 && `${counts.unlinked_blockers} Blocker ohne Maßnahme`}
{counts.unlinked_blockers > 0 && counts.unlinked_evidence > 0 && ' · '}
{counts.unlinked_evidence > 0 && `${counts.unlinked_evidence} Nachweise ohne Maßnahme`}
{' — unter „Erweitert“ verknüpfen oder aufräumen.'}
</p>
)}
</section>
)
}