import { Link } from 'react-router-dom' import { LIFECYCLE_LABELS, PHASE_LABELS, PHASE_DESCRIPTIONS, SIGNAL_LABELS, NEXT_ACTION_KIND_LABELS, } from '../constants/operating.js' import { MILESTONE_STATUS_LABELS } from '../constants/status.js' function formatDate(iso) { if (!iso) return '—' try { return new Date(iso).toLocaleDateString('de-DE') } catch { return iso } } export function SteeringSnapshotPanel({ snapshot, loading, error, methods = [], canManageMethod = false, onMethodChange, methodBusy = false, }) { if (loading) { return (

Steuerungszustand wird geladen …

) } if (error || !snapshot) { return (

Steuerungszustand

{error || 'Snapshot nicht verfügbar — bitte Seite neu laden (Strg+F5).'}

) } const { lifecycle_state, lifecycle_label, method_key, method_label, operating_phase, operating_phase_deprecated, phase_signals, counts, upcoming_milestones = [], next_actions = [], } = snapshot const displayLabel = lifecycle_label || LIFECYCLE_LABELS[lifecycle_state] || PHASE_LABELS[operating_phase] || lifecycle_state || operating_phase const phaseDesc = lifecycle_state ? null : PHASE_DESCRIPTIONS[operating_phase] || '' return (

Steuerungszustand

{displayLabel}
{(method_label || canManageMethod) && (

Methode: {canManageMethod && methods.length > 0 ? ( ) : ( {method_label || method_key} )}

)} {phaseDesc &&

{phaseDesc}

} {phase_signals?.length > 0 && (

{phase_signals.map((s) => SIGNAL_LABELS[s] || s).join(' · ')}

)} {next_actions.length > 0 && (

Nächste Schritte für dieses Vorhaben

    {next_actions.map((item, i) => (
  1. {i + 1} {item.title} {NEXT_ACTION_KIND_LABELS[item.kind] || item.kind} {item.recommended_action ? ` — ${item.recommended_action}` : ''}
  2. ))}
)} {upcoming_milestones.length > 0 && (

Meilenstein-Horizont

)}
Offene Maßnahmen
{counts.actions_open}
Blockiert
{counts.actions_blocked}
Review nötig
{counts.actions_review_required}
Offene Blocker
{counts.blockers_open}
{(counts.unlinked_blockers > 0 || counts.unlinked_evidence > 0) && (
Unverknüpft
{counts.unlinked_blockers} Blocker, {counts.unlinked_evidence} Evidence
)}

Steuerungszustand über Standard Lifecycle {lifecycle_state ? ` (${lifecycle_state})` : ''}.

) }