AP0.10b: Steering UI Minimum — Next Actions, Heute, Snapshot v2
Deploy Development / deploy (push) Successful in 45s
Test Suite / pytest-backend (push) Successful in 1m13s
Test Suite / lint-backend (push) Successful in 2s
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 15s

Workspace beantwortet die Leitfrage mit prominenten Next-Action- und Heute-Widgets sowie erweitertem Steuerungszustand pro Vorhaben.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-07-05 15:55:05 +02:00
1 parent 6ea663b4c4
commit 451d62ed46
20 files changed
+892 -21

No files matched your search

+5
View File
@@ -6,6 +6,8 @@ import { LoadingState } from '../components/LoadingState.jsx'
import { WidgetCard } from '../components/WidgetCard.jsx'
import { EmptyState } from '../components/EmptyState.jsx'
import { ATTENTION_KIND_LABELS } from '../constants/operating.js'
const SEVERITY_LABELS = {
critical: 'Kritisch',
warning: 'Warnung',
@@ -69,6 +71,9 @@ export function AttentionWidget() {
<span className={`attention-severity attention-severity--${item.severity}`}>
{SEVERITY_LABELS[item.severity] || item.severity}
</span>
<span className="muted list-item-sub attention-kind">
{ATTENTION_KIND_LABELS[item.kind] || item.kind}
</span>
<strong>{item.title}</strong>
{item.summary && <p className="list-item-desc muted">{item.summary}</p>}
</div>
+78
View File
@@ -0,0 +1,78 @@
import { useCallback, useEffect, useState } from 'react'
import { Link } from 'react-router-dom'
import { getNextActionCandidates } from '../api/attention.js'
import { NEXT_ACTION_KIND_LABELS } from '../constants/operating.js'
import { EmptyState } from '../components/EmptyState.jsx'
import { ErrorState } from '../components/ErrorState.jsx'
import { LoadingState } from '../components/LoadingState.jsx'
import { WidgetCard } from '../components/WidgetCard.jsx'
export function NextActionWidget() {
const [items, setItems] = useState([])
const [loading, setLoading] = useState(true)
const [error, setError] = useState(null)
const load = useCallback(async () => {
setLoading(true)
setError(null)
try {
const data = await getNextActionCandidates(5)
setItems(Array.isArray(data) ? data : [])
} catch (err) {
setError(err.message)
} finally {
setLoading(false)
}
}, [])
useEffect(() => {
load()
}, [load])
return (
<WidgetCard
title="Nächste sinnvolle Schritte"
subtitle="Was bringt deine Vorhaben jetzt am wirksamsten voran?"
className="widget-card--span-full"
actions={
<button type="button" className="btn btn-ghost" onClick={load} disabled={loading}>
Aktualisieren
</button>
}
>
{loading && <LoadingState />}
{!loading && error && <ErrorState message={error} onRetry={load} />}
{!loading && !error && items.length === 0 && (
<EmptyState message="Keine Empfehlungen — entweder alles erledigt oder noch nichts zu steuern." />
)}
{!loading && !error && items.length > 0 && (
<ol className="item-list next-action-list">
{items.map((item, index) => (
<li key={`${item.kind}-${item.initiative_id}-${item.action_id || item.backlog_item_id || index}`} className="list-item card-list-item">
<div className="list-item-main">
<span className="next-action-rank">{index + 1}</span>
<span className="badge status-badge status-active next-action-kind">
{NEXT_ACTION_KIND_LABELS[item.kind] || item.kind}
</span>
<strong>{item.title}</strong>
{item.summary && <p className="list-item-desc muted">{item.summary}</p>}
{item.recommended_action && (
<p className="list-item-sub recommended-action">
→ {item.recommended_action}
</p>
)}
</div>
<div className="list-item-meta">
{item.initiative_id && (
<Link to={`/initiatives/${item.initiative_id}`} className="btn btn-primary btn-sm">
Zum Vorhaben
</Link>
)}
</div>
</li>
))}
</ol>
)}
</WidgetCard>
)
}
@@ -0,0 +1,98 @@
import { useCallback, useEffect, useState } from 'react'
import { Link } from 'react-router-dom'
import { listWorkspaceTodayActions } from '../api/workspace.js'
import { StatusBadge } from '../components/StatusBadge.jsx'
import { PriorityBadge } from '../components/PriorityBadge.jsx'
import { EmptyState } from '../components/EmptyState.jsx'
import { ErrorState } from '../components/ErrorState.jsx'
import { LoadingState } from '../components/LoadingState.jsx'
import { WidgetCard } from '../components/WidgetCard.jsx'
function formatDue(iso) {
if (!iso) return null
try {
return new Date(iso).toLocaleString('de-DE', {
day: '2-digit',
month: '2-digit',
hour: '2-digit',
minute: '2-digit',
})
} catch {
return iso
}
}
export function WorkspaceTodayWidget() {
const [actions, setActions] = useState([])
const [loading, setLoading] = useState(true)
const [error, setError] = useState(null)
const load = useCallback(async () => {
setLoading(true)
setError(null)
try {
const data = await listWorkspaceTodayActions(10)
setActions(Array.isArray(data) ? data : [])
} catch (err) {
setError(err.message)
} finally {
setLoading(false)
}
}, [])
useEffect(() => {
load()
}, [load])
return (
<WidgetCard
title="Heute"
subtitle="Deine Maßnahmen — überfällig und dringend zuerst"
actions={
<button type="button" className="btn btn-ghost" onClick={load} disabled={loading}>
Aktualisieren
</button>
}
footer={
actions.length > 0 ? (
<Link to="/my-actions" className="link-inline">
Alle meine Maßnahmen →
</Link>
) : null
}
>
{loading && <LoadingState />}
{!loading && error && <ErrorState message={error} onRetry={load} />}
{!loading && !error && actions.length === 0 && (
<EmptyState message="Keine Maßnahmen für heute — prüfe „Nächste sinnvolle Schritte“ oben." />
)}
{!loading && !error && actions.length > 0 && (
<ul className="item-list">
{actions.map((action) => (
<li key={action.id} className="list-item card-list-item">
<div className="list-item-main">
{action.is_overdue && (
<span className="badge status-badge status-blocked">Überfällig</span>
)}
<strong>{action.title}</strong>
{action.initiative_title && (
<span className="muted list-item-sub">{action.initiative_title}</span>
)}
{action.due_at && (
<span className="muted list-item-sub">Fällig: {formatDue(action.due_at)}</span>
)}
</div>
<div className="list-item-meta">
<StatusBadge status={action.status} />
<PriorityBadge priority={action.priority} />
<Link to={`/initiatives/${action.initiative_id}`} className="btn btn-secondary btn-sm">
Öffnen
</Link>
</div>
</li>
))}
</ul>
)}
</WidgetCard>
)
}