AP1.2c: IA-Skeleton — Workspace-Portfolio, Initiative-Übersicht, Unterseiten
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Successful in 1m26s
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 17s
Test Suite / playwright-smoke (push) Successful in 12s
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Successful in 1m26s
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 17s
Test Suite / playwright-smoke (push) Successful in 12s
Neue Navigation: Steuerung/Plan/Ausführung/Eingang/Journey. InitiativeOperationsContext, Action-Detail-Route, NextActionWidget portfolio/initiative, Portfolio-Widget auf Workspace. Omnibus InitiativeDetail entfernt. Version 0.12.0-ap1.2c.
This commit is contained in:
1 parent
2796965aed
commit
687aad6cbd
23 files changed
+1171
-265
No files matched your search
@@ -0,0 +1,71 @@
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { listInitiatives } from '../api/initiatives.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'
|
||||
|
||||
export function InitiativePortfolioWidget() {
|
||||
const [initiatives, setInitiatives] = useState([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [error, setError] = useState(null)
|
||||
|
||||
const load = useCallback(async () => {
|
||||
setLoading(true)
|
||||
setError(null)
|
||||
try {
|
||||
const data = await listInitiatives()
|
||||
setInitiatives(Array.isArray(data) ? data : [])
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
load()
|
||||
}, [load])
|
||||
|
||||
return (
|
||||
<WidgetCard
|
||||
title="Portfolio — alle Vorhaben"
|
||||
subtitle="Querschnitt über deine Initiativen. Klick öffnet die Steuerungs-Übersicht."
|
||||
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 && initiatives.length === 0 && (
|
||||
<EmptyState message="Noch keine Vorhaben — lege dein erstes Programm an." />
|
||||
)}
|
||||
{!loading && !error && initiatives.length > 0 && (
|
||||
<div className="initiative-portfolio-grid">
|
||||
{initiatives.map((item) => (
|
||||
<Link
|
||||
key={item.id}
|
||||
to={`/initiatives/${item.id}`}
|
||||
className="initiative-portfolio-card card"
|
||||
>
|
||||
<h3 className="initiative-portfolio-card-title">{item.title}</h3>
|
||||
{item.goal && (
|
||||
<p className="initiative-portfolio-card-goal muted">{item.goal}</p>
|
||||
)}
|
||||
<div className="initiative-portfolio-card-badges">
|
||||
<StatusBadge kind="initiative" status={item.status} />
|
||||
<PriorityBadge priority={item.priority} />
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</WidgetCard>
|
||||
)
|
||||
}
|
||||
@@ -7,72 +7,147 @@ import { ErrorState } from '../components/ErrorState.jsx'
|
||||
import { LoadingState } from '../components/LoadingState.jsx'
|
||||
import { WidgetCard } from '../components/WidgetCard.jsx'
|
||||
|
||||
export function NextActionWidget() {
|
||||
function NextActionList({ items, initiativeId, showInitiativeLink = true }) {
|
||||
if (items.length === 0) {
|
||||
return (
|
||||
<EmptyState message="Keine Empfehlungen — entweder alles erledigt oder noch nichts zu steuern." />
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<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.action_id && initiativeId && (
|
||||
<Link
|
||||
to={`/initiatives/${initiativeId}/actions/${item.action_id}`}
|
||||
className="btn btn-primary btn-sm"
|
||||
>
|
||||
Arbeitspaket
|
||||
</Link>
|
||||
)}
|
||||
{showInitiativeLink && item.initiative_id && !initiativeId && (
|
||||
<Link to={`/initiatives/${item.initiative_id}`} className="btn btn-primary btn-sm">
|
||||
Zum Vorhaben
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
)
|
||||
}
|
||||
|
||||
export function NextActionWidget({
|
||||
scope = 'portfolio',
|
||||
initiativeId = null,
|
||||
limit = 5,
|
||||
items: externalItems = null,
|
||||
loading: externalLoading = null,
|
||||
embedded = false,
|
||||
title,
|
||||
subtitle,
|
||||
onReload: externalReload,
|
||||
}) {
|
||||
const [items, setItems] = useState([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [loading, setLoading] = useState(scope === 'portfolio')
|
||||
const [error, setError] = useState(null)
|
||||
|
||||
const load = useCallback(async () => {
|
||||
if (scope === 'initiative') return
|
||||
setLoading(true)
|
||||
setError(null)
|
||||
try {
|
||||
const data = await getNextActionCandidates(5)
|
||||
const data = await getNextActionCandidates(limit)
|
||||
setItems(Array.isArray(data) ? data : [])
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}, [])
|
||||
}, [scope, limit])
|
||||
|
||||
useEffect(() => {
|
||||
load()
|
||||
}, [load])
|
||||
if (scope === 'portfolio') {
|
||||
load()
|
||||
}
|
||||
}, [scope, load])
|
||||
|
||||
const displayItems =
|
||||
scope === 'initiative'
|
||||
? (externalItems || []).slice(0, limit)
|
||||
: items
|
||||
const isLoading = scope === 'initiative' ? externalLoading : loading
|
||||
const handleReload = scope === 'initiative' ? externalReload : load
|
||||
|
||||
const heading =
|
||||
title ||
|
||||
(scope === 'initiative'
|
||||
? 'Nächste Schritte in diesem Vorhaben'
|
||||
: 'Nächste sinnvolle Schritte')
|
||||
const sub =
|
||||
subtitle ||
|
||||
(scope === 'initiative'
|
||||
? 'Empfehlungen aus dem Steuerungs-Snapshot.'
|
||||
: 'Was bringt deine Vorhaben jetzt am wirksamsten voran?')
|
||||
|
||||
const body = (
|
||||
<>
|
||||
{isLoading && <LoadingState />}
|
||||
{!isLoading && error && <ErrorState message={error} onRetry={handleReload} />}
|
||||
{!isLoading && !error && (
|
||||
<NextActionList
|
||||
items={displayItems}
|
||||
initiativeId={initiativeId}
|
||||
showInitiativeLink={scope === 'portfolio'}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
|
||||
if (embedded) {
|
||||
return (
|
||||
<section className="card next-action-embedded">
|
||||
<div className="section-header">
|
||||
<div>
|
||||
<h2>{heading}</h2>
|
||||
<p className="section-lead muted">{sub}</p>
|
||||
</div>
|
||||
</div>
|
||||
{body}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<WidgetCard
|
||||
title="Nächste sinnvolle Schritte"
|
||||
subtitle="Was bringt deine Vorhaben jetzt am wirksamsten voran?"
|
||||
title={heading}
|
||||
subtitle={sub}
|
||||
className="widget-card--span-full"
|
||||
actions={
|
||||
<button type="button" className="btn btn-ghost" onClick={load} disabled={loading}>
|
||||
Aktualisieren
|
||||
</button>
|
||||
scope === 'portfolio' ? (
|
||||
<button type="button" className="btn btn-ghost" onClick={load} disabled={isLoading}>
|
||||
Aktualisieren
|
||||
</button>
|
||||
) : null
|
||||
}
|
||||
>
|
||||
{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>
|
||||
)}
|
||||
{body}
|
||||
</WidgetCard>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user