// THE INBOX'S ONE NUMBER (plans/umtool-redesign.md, P3; canvas "Inbox"): the // calls waiting on the operator, and the sentence under it. Pure, over the // grouped summary lib/inbox/groups.mjs `summarizeGroups` makes, so the page, // the rail's count and the CLI say the same number. // // calls cards in the groups that ask for a call -- Your call, Review, // Blocking, Notes, Open -- on ACTIVE pieces (a card is one piece and // one kind: 483 unadjudicated claims on one video are one call) // rows the decisions those cards hold // ready cards in Ready to finish (a suggestion, never a call) // quiet decisions in Quiet (facts, collapsed) // hidden decisions on parked or done pieces, every group /** The groups whose cards are calls. */ export const CALL_GROUPS = ["your-call", "review", "blocking", "notes", "open"]; /** * @param {Array<{ id: string, decisions: number, hidden: number, cards: unknown[] }>} groups * @returns {{ calls: number, rows: number, ready: number, quiet: number, hidden: number }} */ export function inboxHeadline(groups) { const out = { calls: 0, rows: 0, ready: 0, quiet: 0, hidden: 0 }; for (const g of groups) { out.hidden += g.hidden; if (CALL_GROUPS.includes(g.id)) { out.calls += g.cards.length; out.rows += g.decisions; } else if (g.id === "ready-to-finish") out.ready += g.cards.length; else if (g.id === "quiet") out.quiet += g.decisions; } return out; } /** The sentence under the number: "101 rows · 1 piece ready to finish · 126 quiet". */ export function headlineNote(h) { const parts = [`${h.rows} row${h.rows === 1 ? "" : "s"}`]; if (h.ready) parts.push(`${h.ready} piece${h.ready === 1 ? "" : "s"} ready to finish`); parts.push(`${h.quiet} quiet`); if (h.hidden) parts.push(`${h.hidden} hidden`); return parts.join(" · "); }