import { LIFECYCLE_LABELS } from '../constants/operating.js'
import { Link } from 'react-router-dom'
export function InitiativeLifecycleBar({
snapshot,
loading,
error,
initiativeId,
compact = false,
}) {
if (loading) {
return (
Steuerungszustand wird geladen …
)
}
if (error || !snapshot) {
return (
Steuerungszustand nicht verfügbar — siehe Tab{' '}
Steuerung.
)
}
const displayLabel =
snapshot.lifecycle_label ||
LIFECYCLE_LABELS[snapshot.lifecycle_state] ||
snapshot.lifecycle_state
const stats = [
{ label: 'Offen', value: snapshot.counts?.actions_open ?? 0, warn: false },
{
label: 'Blockiert',
value: snapshot.counts?.actions_blocked ?? 0,
warn: (snapshot.counts?.actions_blocked ?? 0) > 0,
},
{
label: 'Review',
value: snapshot.counts?.actions_review_required ?? 0,
warn: (snapshot.counts?.actions_review_required ?? 0) > 0,
},
{
label: 'Blocker',
value: snapshot.counts?.blockers_open ?? 0,
warn: (snapshot.counts?.blockers_open ?? 0) > 0,
},
]
return (
Programm-Fortschritt
{displayLabel}
Steuerung
{stats.map(({ label, value, warn }) => (
{value} {label}
))}
)
}