Deploy Development / deploy (push) Successful in 50s
Test Suite / pytest-backend (push) Successful in 4m54s
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 19s
Test Suite / playwright-smoke (push) Successful in 13s
Gate-Detail: Übungen anlegen mit Rhythmus, Gate aktivieren, Link zu Today. API: /roadmap-items/{id}/practices und roadmap_item_id auf Recurring-Create. Damit ist A1 ohne Starter-Kit manuell durchspielbar.
Co-authored-by: Cursor <cursoragent@cursor.com>
111 lines
3.8 KiB
React
111 lines
3.8 KiB
React
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
|
|
}
|
|
}
|
|
|
|
function activeMaturityStages(roadmapItems = []) {
|
|
return [...roadmapItems]
|
|
.filter((item) => item.item_type === 'maturity_stage' && item.status === 'active')
|
|
.sort((a, b) => (a.sort_order ?? 0) - (b.sort_order ?? 0))
|
|
}
|
|
|
|
function practicesForStage(recurringItems = [], stageId) {
|
|
if (!stageId) {
|
|
return (recurringItems || []).filter((item) => item.roadmap_item_id)
|
|
}
|
|
return (recurringItems || []).filter((item) => item.roadmap_item_id === stageId)
|
|
}
|
|
|
|
export function RecurringRhythmPanel({
|
|
initiativeId,
|
|
roadmapItems = [],
|
|
recurringItems = [],
|
|
canManage = false,
|
|
embedded = true,
|
|
}) {
|
|
const stages = activeMaturityStages(roadmapItems)
|
|
const stagePractices = stages.flatMap((stage) =>
|
|
practicesForStage(recurringItems, stage.id),
|
|
)
|
|
const active = stagePractices.filter((item) => item.status === 'active')
|
|
const paused = stagePractices.filter((item) => item.status === 'paused')
|
|
|
|
const body =
|
|
stages.length === 0 ? (
|
|
<EmptyState message="Keine aktiven Work-Gates — Plan → Struktur prüfen." />
|
|
) : stagePractices.length === 0 ? (
|
|
<EmptyState message="Keine Übungen auf aktiven Gates — Starter-Kit oder Join prüfen." />
|
|
) : (
|
|
<>
|
|
<p className="recurring-rhythm-summary muted">
|
|
{stages.length} aktive Gate(s) — {active.length} Übung(en) aktiv
|
|
{paused.length > 0 ? `, ${paused.length} pausiert` : ''}.
|
|
</p>
|
|
<ul className="item-list recurring-rhythm-list">
|
|
{[...active, ...paused].map((item) => (
|
|
<li
|
|
key={item.id}
|
|
className={
|
|
'list-item card-list-item recurring-rhythm-item' +
|
|
(item.status === 'active' ? ' recurring-rhythm-item--active' : '') +
|
|
(item.today_completed ? ' recurring-rhythm-item--done-today' : '')
|
|
}
|
|
>
|
|
<div className="list-item-main">
|
|
<strong>{item.title}</strong>
|
|
<span className="muted list-item-sub">
|
|
{RECURRING_STATUS_LABELS[item.status] || item.status}
|
|
{item.today_completed ? ' · heute erledigt' : ''}
|
|
{!item.today_completed && item.next_due_at
|
|
? ` · Fällig: ${formatDueAt(item.next_due_at)}`
|
|
: ''}
|
|
</span>
|
|
{item.today_measurement_note && (
|
|
<span className="muted list-item-sub">Messwert: {item.today_measurement_note}</span>
|
|
)}
|
|
</div>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
<p className="muted recurring-rhythm-hint">
|
|
{canManage
|
|
? 'Übungen anlegen und Rhythmus pflegen am '
|
|
: 'Übungen am '}
|
|
<Link to={scopedPath('/plan/gates', { initiativeId })} className="link-inline">
|
|
Zielzustand (Gate-Detail)
|
|
</Link>
|
|
{' '}— Activity Set pro Gate. Heute erledigen unter{' '}
|
|
<Link to={scopedPath('/work/today', { initiativeId })} className="link-inline">
|
|
Ausführen → Today
|
|
</Link>
|
|
.
|
|
</p>
|
|
</>
|
|
)
|
|
|
|
if (!embedded) return body
|
|
|
|
return (
|
|
<section className="card recurring-rhythm-panel">
|
|
<div className="section-header">
|
|
<div>
|
|
<h2>Übungen der aktiven Gates</h2>
|
|
<p className="section-lead muted">
|
|
Activity Sets aller aktiven Work-Gates — Join-Knoten haben keine Übungen (A1).
|
|
</p>
|
|
</div>
|
|
</div>
|
|
{body}
|
|
</section>
|
|
)
|
|
}
|