feat(AP2.2c): A1 Reifegrad E2E, Stufen-/Rhythmus-Panels und Composition-Kernel
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
43d33d0edb
commit
02b6469c2d
11 files changed
+420
-4
No files matched your search
@@ -0,0 +1,72 @@
|
||||
import { Link } from 'react-router-dom'
|
||||
import { MILESTONE_STATUS_LABELS } from '../constants/status.js'
|
||||
import { EmptyState } from './EmptyState.jsx'
|
||||
import { scopedPath } from '../utils/routes.js'
|
||||
|
||||
export function MaturityStagePanel({
|
||||
initiativeId,
|
||||
roadmapItems = [],
|
||||
embedded = true,
|
||||
}) {
|
||||
const stages = [...roadmapItems]
|
||||
.filter((item) => item.item_type === 'maturity_stage')
|
||||
.sort((a, b) => (a.sort_order ?? 0) - (b.sort_order ?? 0))
|
||||
|
||||
const activeStage = stages.find((s) => s.status === 'active')
|
||||
|
||||
const body =
|
||||
stages.length === 0 ? (
|
||||
<EmptyState message="Noch keine Reifegrad-Stufen — unter Plan anlegen oder Starter-Kit nutzen." />
|
||||
) : (
|
||||
<>
|
||||
{activeStage && (
|
||||
<p className="maturity-stage-active muted">
|
||||
Aktive Stufe: <strong>{activeStage.title}</strong>
|
||||
</p>
|
||||
)}
|
||||
<ol className="item-list maturity-stage-list">
|
||||
{stages.map((stage, index) => (
|
||||
<li
|
||||
key={stage.id}
|
||||
className={
|
||||
'list-item card-list-item maturity-stage-item' +
|
||||
(stage.status === 'active' ? ' maturity-stage-item--active' : '') +
|
||||
(stage.status === 'reached' ? ' maturity-stage-item--reached' : '')
|
||||
}
|
||||
>
|
||||
<span className="maturity-stage-item__index muted">{index + 1}</span>
|
||||
<div className="list-item-main">
|
||||
<strong>{stage.title}</strong>
|
||||
<span className="muted list-item-sub">
|
||||
{MILESTONE_STATUS_LABELS[stage.status] || stage.status}
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
<p className="muted maturity-stage-hint">
|
||||
Stufen und Übungen unter{' '}
|
||||
<Link to={scopedPath('/control/journey', { initiativeId })} className="link-inline">
|
||||
Kontrolle → Rhythmen & Journey
|
||||
</Link>
|
||||
.
|
||||
</p>
|
||||
</>
|
||||
)
|
||||
|
||||
if (!embedded) return body
|
||||
|
||||
return (
|
||||
<section className="card maturity-stage-panel">
|
||||
<div className="section-header">
|
||||
<div>
|
||||
<h2>Reifegrad-Stufen</h2>
|
||||
<p className="section-lead muted">
|
||||
Aktive Stufe und Fortschritt — Steuerungshorizont für Reifegrad-Vorhaben (A1).
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{body}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
import { Link } from 'react-router-dom'
|
||||
import { RECURRING_STATUS_LABELS } from '../constants/status.js'
|
||||
import { EmptyState } from './EmptyState.jsx'
|
||||
import { scopedPath } from '../utils/routes.js'
|
||||
|
||||
function formatDueAt(iso) {
|
||||
if (!iso) return null
|
||||
try {
|
||||
return new Date(iso).toLocaleString('de-DE')
|
||||
} catch {
|
||||
return iso
|
||||
}
|
||||
}
|
||||
|
||||
export function RecurringRhythmPanel({
|
||||
initiativeId,
|
||||
recurringItems = [],
|
||||
embedded = true,
|
||||
}) {
|
||||
const sorted = [...recurringItems].sort((a, b) => {
|
||||
const statusOrder = { active: 0, paused: 1, archived: 2 }
|
||||
const diff = (statusOrder[a.status] ?? 9) - (statusOrder[b.status] ?? 9)
|
||||
if (diff !== 0) return diff
|
||||
return (a.title || '').localeCompare(b.title || '', 'de')
|
||||
})
|
||||
|
||||
const active = sorted.filter((item) => item.status === 'active')
|
||||
|
||||
const body =
|
||||
sorted.length === 0 ? (
|
||||
<EmptyState message="Noch keine Rhythmen — Starter-Kit oder Journey legt Übungen an." />
|
||||
) : (
|
||||
<>
|
||||
{active.length > 0 && (
|
||||
<p className="recurring-rhythm-summary muted">
|
||||
{active.length} aktive Routine{active.length === 1 ? '' : 'n'} — fällige Übung steuert
|
||||
Next Action.
|
||||
</p>
|
||||
)}
|
||||
<ul className="item-list recurring-rhythm-list">
|
||||
{sorted.map((item) => (
|
||||
<li
|
||||
key={item.id}
|
||||
className={
|
||||
'list-item card-list-item recurring-rhythm-item' +
|
||||
(item.status === 'active' ? ' recurring-rhythm-item--active' : '')
|
||||
}
|
||||
>
|
||||
<div className="list-item-main">
|
||||
<strong>{item.title}</strong>
|
||||
<span className="muted list-item-sub">
|
||||
{RECURRING_STATUS_LABELS[item.status] || item.status}
|
||||
{item.next_due_at ? ` · Fällig: ${formatDueAt(item.next_due_at)}` : ''}
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<p className="muted recurring-rhythm-hint">
|
||||
Rhythmen pflegen unter{' '}
|
||||
<Link to={scopedPath('/control/journey', { initiativeId })} className="link-inline">
|
||||
Kontrolle → Journey
|
||||
</Link>
|
||||
.
|
||||
</p>
|
||||
</>
|
||||
)
|
||||
|
||||
if (!embedded) return body
|
||||
|
||||
return (
|
||||
<section className="card recurring-rhythm-panel">
|
||||
<div className="section-header">
|
||||
<div>
|
||||
<h2>Rhythmen & Übungen</h2>
|
||||
<p className="section-lead muted">
|
||||
Aktive Routinen am Reifegrad-Pfad — Leading Next aus fälliger Übung (A1).
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{body}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user