import { useState } from 'react' import { groupPulse, LANES, lastMonths, type PulseEvent } from '../pulse' const TONE_VAR: Record = { accent: 'var(--accent)', ok: 'var(--ok)', warn: 'var(--warn)', err: 'var(--err)', } /** * Relationship pulse — last 12 months (H-04's timeline ribbon). * Four lanes on a shared month axis; hover fills the readout bar; click opens * the record. Plain DOM dots — no chart library. */ export function PulseRibbon(props: { events: PulseEvent[] todayIso: string onOpen: (ev: PulseEvent) => void }) { const months = lastMonths(props.todayIso) const cells = groupPulse(props.events, months) const [focus, setFocus] = useState() return (

Relationship pulse — last 12 months

{([['accent', 'ACTIVITY'], ['ok', 'PAID / POSITIVE'], ['warn', 'PENDING / RENEWAL'], ['err', 'NEEDS ATTENTION']] as const).map(([tone, label]) => ( {label} ))}
{LANES.map((lane, li) => (
{lane}
{months.map((m, mi) => { const evs = cells.get(`${li}:${mi}`) ?? [] return (
{evs.slice(0, 3).map((ev) => (
) })}
))}
{months.map((m) => (
{m.slice(5)}/{m.slice(2, 4)}
))}
{focus !== undefined ? <>{focus.date} · {focus.label} open → : 'Hover an event · click to open it'}
) }