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 ? ( ) : ( <> {active.length > 0 && (

{active.length} aktive Routine{active.length === 1 ? '' : 'n'} — fällige Übung steuert Next Action.

)}

Rhythmen pflegen unter{' '} Kontrolle → Journey .

) if (!embedded) return body return (

Rhythmen & Übungen

Aktive Routinen am Reifegrad-Pfad — Leading Next aus fälliger Übung (A1).

{body}
) }