Attention-queue types and pure logic: filters, money-and-time sort with bands, stories of related items counted once per record, snooze presets, item state with the acknowledgement timer, brief and handover types, when a handover is due.
Part of High Command Pro. The preview and props are open to everyone; installing it needs your license key. Set up your key · Pricing
$ npx shadcn@latest add @highcommand/ops-libCopies the source into your project and pulls in what it needs (3 other items). First time? Add the registry to components.json.
sumAtStake(stakes: readonly (Pick<AtStake, "basis" | "amount_minor" | "record"> | null | undefined)[]): { minor: number; estimated: boolean; n: number; } | nullAdds up money at stake counting each record once (its largest amount); null when there is none. `estimated` is true if any counted amount is an estimate, `n` how many records were counted.
keptBy(items: QueueItem[], f: QueueFilters): QueueItem[]The items the status and other filters keep (severity aside): what the severity chips count.
severityLevels(items: QueueItem[], hidden: ReadonlySet<string>): { level: string; count: number; }[]Levels to offer as chips: the known ones that have items (or are switched off, so they can be switched back on), then any other level in the data.
viewQueue(items: QueueItem[], hidden: ReadonlySet<string>, sort: QueueSort, filters?: QueueFilters | undefined): QueueItem[]The rows the queue shows, in order: filtered by severity and (when given) the other filters, then sorted (ties fall back to severity, newest, then a stable key). Without `filters` every item counts, snoozed or not (the caller filtered already).
filterOptions(items: QueueItem[]): { types: string[]; accounts: { id: string; name: string; }[]; }Distinct values for the type and account filters, A-Z.
urgencyScore(i: QueueItem, now: number | null): numberMoney weighted by urgency: the full amount when it is already costing (past its time), halved a day out, a third two days out, and so on (24 / (24 + hours)). Unknown money scores 0, so those items follow the ones with a figure, soonest first.
fmtStake(s: Pick<AtStake, "basis" | "amount_minor"> | null | undefined): string"$23.5k", "≈ $46.2k" (estimated), "—" (unknown, never guessed).
fmtStakeShort(minor: number): stringThe money at stake in the rail's width: "$663k", "$1.2M", "$412"; the estimate's mark is the rail's tooltip.
fmtImpact(i: ImpactAt | null | undefined, nowIso: string): stringTime to impact from now: "45 min", "6 h 20 m", "2 d 6 h"; once past, how long ago: "5 h over", "34 d over"; a tracker gap is "now".
bandOf(i: Pick<QueueItem, "impact" | "severity">, nowIso: string): BandThe time band an item falls in (now, next 2 h, later today, beyond today or no date), from its impact time and severity.
entriesOf(sorted: QueueItem[], ungrouped?: ReadonlySet<string>): QueueEntry[]The rows in order, related items folded into one story: items that share an explicit link become one row at the place of the first of them, with the worst severity, the total at stake and the earliest impact. A story the person ungrouped shows its items apart.
queueStakeTotal(items: readonly QueueItem[], nowIso: string | null): { minor: number; estimated: boolean; n: number; } | nullThe money at stake on the queue's open items (not snoozed), each record once: the header's total.
stateOf(it: QueueItem, nowIso: string): { key: "woke" | "snoozed" | "timer_ended" | "acknowledged" | "assigned" | "new"; text: string; timer: string | null; }The item's state as a pill: New, Assigned, Acknowledged (with its timer), Timer ended, Snoozed (until a time or an event), Woke. An acknowledgement older than one shift is "Timer ended": back with everyone as New.
presets(nowIso: string): { label: string; until: string; }[]Snooze choices from now, in the viewer's own time zone: an hour, tomorrow 08:00, three days, next Monday 08:00 (never past the 7-day limit).
handoverDue(view: HandoverView | null | undefined, failed: boolean, me: string | null, nowIso: string): HandoverDue | nullWhat the shift handover line should say for this person (a note to acknowledge, a question to answer, a shift ending unsigned, or a failed read), or null when nothing is due.
activeFilterCount(f: QueueFilters): numberHow many filters are on (type, account, owner, a status other than active, a minimum stake); severity is not counted.
itemKey(i: Pick<QueueItem, "kind" | "ref">): stringA row's key: its record and kind.
typeOf(i: QueueItem): stringWhat kind of item it is, as the queue names it ("Receivable past due", "Shipment late"). The type filter's values.
isSnoozed(i: Pick<QueueItem, "snoozed_until">, now: string | null): booleanTrue when the item is snoozed until after `now` (any snooze counts when now is null).
stakeDollars(i: Pick<QueueItem, "at_stake">): numberDollars at stake (0 when unknown).
isUrgent(i: ImpactAt | null | undefined, nowIso: string): booleanPast its time, or within the next two hours.
storyKey(s: Pick<Story, "key">): stringThe row key of a story ("story:<key>"), as selection and expansion use.
localValue(iso: string): stringThe value of a datetime-local input for an instant, in the viewer's zone.