feat(A1): Minimum Usability Slice — CadenceInstance, Today-Übung, Gate-Fortschritt
Deploy Development / deploy (push) Successful in 44s
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 18s
Test Suite / playwright-smoke (push) Successful in 13s
Deploy Development / deploy (push) Successful in 44s
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 18s
Test Suite / playwright-smoke (push) Successful in 13s
PO No-Go A1 adressieren: Tages-Tracking mit Messnotiz, Work-UI für Übung, Next-Action-Link, Gate-Fortschritt in Kontrolle, Eingang aus A1-Nav entfernt. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
0baa5952bc
commit
b7d88ce24a
25 files changed
+936
-31
No files matched your search
@@ -1,28 +1,66 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { MILESTONE_STATUS_LABELS } from '../constants/status.js'
|
||||
import { listInitiativeRoadmapCriteriaProgress } from '../api/roadmap.js'
|
||||
import { gatePath, scopedPath } from '../utils/routes.js'
|
||||
import { EmptyState } from './EmptyState.jsx'
|
||||
import { scopedPath } from '../utils/routes.js'
|
||||
|
||||
export function MaturityStagePanel({
|
||||
initiativeId,
|
||||
roadmapItems = [],
|
||||
embedded = true,
|
||||
}) {
|
||||
const [criteriaProgress, setCriteriaProgress] = useState({})
|
||||
|
||||
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')
|
||||
|
||||
useEffect(() => {
|
||||
if (!initiativeId) return undefined
|
||||
let cancelled = false
|
||||
listInitiativeRoadmapCriteriaProgress(initiativeId)
|
||||
.then((data) => {
|
||||
if (!cancelled) setCriteriaProgress(data || {})
|
||||
})
|
||||
.catch(() => {
|
||||
if (!cancelled) setCriteriaProgress({})
|
||||
})
|
||||
return () => {
|
||||
cancelled = true
|
||||
}
|
||||
}, [initiativeId, roadmapItems.length])
|
||||
|
||||
const activeProgress = activeStage ? criteriaProgress[activeStage.id] : null
|
||||
|
||||
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>
|
||||
<>
|
||||
<p className="maturity-stage-active muted">
|
||||
Aktive Stufe:{' '}
|
||||
<Link to={gatePath(activeStage.id)} className="link-inline">
|
||||
<strong>{activeStage.title}</strong>
|
||||
</Link>
|
||||
</p>
|
||||
{activeProgress && (
|
||||
<p className="maturity-stage-progress muted">
|
||||
Gate-Fortschritt:{' '}
|
||||
<strong>
|
||||
{activeProgress.closed ?? 0} / {activeProgress.total ?? 0}
|
||||
</strong>{' '}
|
||||
Kriterien erfüllt
|
||||
{(activeProgress.open ?? 0) > 0 && (
|
||||
<span> · {activeProgress.open} offen</span>
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
<ol className="item-list maturity-stage-list">
|
||||
{stages.map((stage, index) => (
|
||||
@@ -36,7 +74,9 @@ export function MaturityStagePanel({
|
||||
>
|
||||
<span className="maturity-stage-item__index muted">{index + 1}</span>
|
||||
<div className="list-item-main">
|
||||
<strong>{stage.title}</strong>
|
||||
<Link to={gatePath(stage.id)} className="list-item-link">
|
||||
<strong>{stage.title}</strong>
|
||||
</Link>
|
||||
<span className="muted list-item-sub">
|
||||
{MILESTONE_STATUS_LABELS[stage.status] || stage.status}
|
||||
</span>
|
||||
@@ -45,9 +85,13 @@ export function MaturityStagePanel({
|
||||
))}
|
||||
</ol>
|
||||
<p className="muted maturity-stage-hint">
|
||||
Stufen und Übungen unter{' '}
|
||||
<Link to={scopedPath('/control/journey', { initiativeId })} className="link-inline">
|
||||
Kontrolle → Rhythmen & Journey
|
||||
Kriterien und Verify am{' '}
|
||||
<Link to={scopedPath('/plan/gates', { initiativeId })} className="link-inline">
|
||||
Plan → Stufen
|
||||
</Link>
|
||||
; Übung unter{' '}
|
||||
<Link to={scopedPath('/work/today', { initiativeId })} className="link-inline">
|
||||
Ausführen → Heute
|
||||
</Link>
|
||||
.
|
||||
</p>
|
||||
@@ -62,7 +106,7 @@ export function MaturityStagePanel({
|
||||
<div>
|
||||
<h2>Reifegrad-Stufen</h2>
|
||||
<p className="section-lead muted">
|
||||
Aktive Stufe und Fortschritt — Steuerungshorizont für Reifegrad-Vorhaben (A1).
|
||||
Aktive Stufe, Gate-Fortschritt und Orientierung — Steuerungshorizont (A1).
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
import { useMemo, useState } from 'react'
|
||||
import { completeRecurringPractice } from '../api/recurring.js'
|
||||
import { EmptyState } from './EmptyState.jsx'
|
||||
|
||||
function formatDue(iso) {
|
||||
if (!iso) return null
|
||||
try {
|
||||
return new Date(iso).toLocaleString('de-DE', { dateStyle: 'medium', timeStyle: 'short' })
|
||||
} catch {
|
||||
return iso
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A1 — Heutige Übung (CadenceInstance): Tages-Tracking mit optionaler Messnotiz.
|
||||
*/
|
||||
export function WorkTodayPracticePanel({
|
||||
initiativeId,
|
||||
recurringItems = [],
|
||||
canManage = false,
|
||||
onCompleted,
|
||||
busy = false,
|
||||
}) {
|
||||
const [measurement, setMeasurement] = useState('')
|
||||
const [submitting, setSubmitting] = useState(false)
|
||||
const [error, setError] = useState(null)
|
||||
|
||||
const activePractice = useMemo(() => {
|
||||
return (recurringItems || []).find((item) => item.status === 'active')
|
||||
}, [recurringItems])
|
||||
|
||||
const openInstance = activePractice?.open_cadence_instance
|
||||
|
||||
if (!activePractice) {
|
||||
return (
|
||||
<section className="card work-today-practice" id="today-practice">
|
||||
<EmptyState message="Keine aktive Übung — Starter-Kit oder Stufenwechsel prüfen." />
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
async function handleComplete(e) {
|
||||
e.preventDefault()
|
||||
if (!canManage || submitting) return
|
||||
setSubmitting(true)
|
||||
setError(null)
|
||||
try {
|
||||
await completeRecurringPractice(activePractice.id, {
|
||||
measurement_note: measurement.trim() || undefined,
|
||||
})
|
||||
setMeasurement('')
|
||||
await onCompleted?.()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setSubmitting(false)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="card work-today-practice" id="today-practice">
|
||||
<div className="section-header">
|
||||
<div>
|
||||
<h2>Heutige Übung</h2>
|
||||
<p className="section-lead muted">
|
||||
Tages-Tracking — erledigt markieren, optional Messwert notieren (z. B. Grad, Wiederholungen).
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="work-today-practice__focus">
|
||||
<strong>{activePractice.title}</strong>
|
||||
{openInstance?.due_at && (
|
||||
<p className="muted list-item-sub">Fällig: {formatDue(openInstance.due_at)}</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{canManage ? (
|
||||
<form className="inline-form-block work-today-practice__form" onSubmit={handleComplete}>
|
||||
<label>
|
||||
Messwert / Notiz (optional)
|
||||
<input
|
||||
value={measurement}
|
||||
onChange={(e) => setMeasurement(e.target.value)}
|
||||
placeholder="z. B. 45° Spagat, 3×30 Sek."
|
||||
maxLength={2000}
|
||||
/>
|
||||
</label>
|
||||
{error && <p className="error">{error}</p>}
|
||||
<button type="submit" className="btn btn-primary" disabled={submitting || busy}>
|
||||
{submitting ? 'Speichern …' : 'Heute erledigt'}
|
||||
</button>
|
||||
</form>
|
||||
) : (
|
||||
<p className="muted">Keine Berechtigung zum Markieren der Übung.</p>
|
||||
)}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user