// One line of the agenda: when, what, where, on a surface tinted with its calendar's colour. Same // rule as a block on the grid, and the same tokens, drawn a shade weaker: a row is several times // the area of a block, and a fortnight of them at the grid's strength is a stack of highlighter. import { memo } from "react"; import type { InstanceKey } from "../ipc"; import { calVars, keyOf, vars, eventTitle } from "./GridModel"; import { splitMatch, timeLabel, type AgendaItem } from "./AgendaModel"; interface AgendaRowProps { item: AgendaItem; selected: boolean; /** Lowercased search terms to mark in the summary. Empty in the agenda proper. */ terms: readonly string[]; onSelect: (key: InstanceKey) => void; onOpen?: (key: InstanceKey) => void; } export const AgendaRow = memo(function AgendaRow({ item, selected, terms, onSelect, onOpen, }: AgendaRowProps) { const { instance } = item; const summary = eventTitle(instance); let hint = summary; if (instance.location) hint += ` · ${instance.location}`; if (instance.status === "tentative") hint += " · tentative"; if (instance.pending) hint += " · not pushed yet"; const parts = terms.length > 0 ? splitMatch(summary, terms) : null; return ( ); });