Triage queue
Plan, Task and Queue: an email with the plan the model proposes, the task a settled email became, and the list around them.
Priya Nair: “Logo files for the spring launch”
Attached are the final SVGs. Can you check they work on the dark footer before Friday?
Create a task in Clients / Launch
Tomas Berg: “Re: invoice 118”
We paid it on the 20th, the receipt is below.
Comment on Invoice 118 reminder
Two open tasks mention this invoice.
Out of office: “Automatic reply: Kickoff call”
I'm away until Monday.
Installation
pnpm add @heyramzi/uiUsage
import { TriagePlan, TriageQueue, TriageTask } from "@heyramzi/ui/triage";<TriageQueue {items} key={(mail) => mail.id} empty="Nothing waiting for you.">
{#snippet row(mail)}
<TriagePlan
sender={mail.from}
subject={mail.subject}
plan={mail.plan}
onApprove={() => approve(mail.id)}
onPick={() => pick(mail.id)}
onDismiss={() => dismiss(mail.id)}
/>
{/snippet}
</TriageQueue>Keyboard and accessibility
| Key | Does |
|---|---|
| Tab | Moves through each card's buttons. |
| Enter | In the task field, runs the task you typed. |
| Esc | In the task field, cancels it. |
- The actions are plain buttons, with no shortcuts.
- A plan card is named by its heading, the sender and subject.
- Errors are alerts, so they're read out as soon as they show.
- While the call runs, Approve, Dismiss and Use task report unavailable and ignore presses. Focus stays on the one you pressed.
- Pick another task puts focus in its field. Cancel and Esc put it back on Pick another task.
- When a card leaves the queue, focus goes to the card now in its place, or to the empty message.
API reference
TriageQueue
itemsrequiredreadonly T[]keyrequired(item: T) => string- The key a row is tracked by.
kind"plans" | "tasks"- Default
"plans" - `plans` stacks cards that need a decision. `tasks` is one divided list of what was decided.
rowrequiredSnippet<[T]>- One row: a `TriagePlan` for `plans`, a `TriageTask` for `tasks`.
emptyrequiredstring- What the person reads when nothing is waiting.
iconSnippet- The glyph above the empty text.
classstring
| Prop | Type | Default |
|---|---|---|
items required | readonly T[] | |
key required The key a row is tracked by. | (item: T) => string | |
kind `plans` stacks cards that need a decision. `tasks` is one divided list of what was decided. | "plans" | "tasks" | "plans" |
row required One row: a `TriagePlan` for `plans`, a `TriageTask` for `tasks`. | Snippet<[T]> | |
empty required What the person reads when nothing is waiting. | string | |
icon The glyph above the empty text. | Snippet | |
class | string |
TriagePlan
senderrequiredstring- Who sent the email.
subjectrequiredstringsnippetstring- The first lines of the body.
receivedstring | null- When it arrived, as text the host already formatted.
receivedAtstring | null- The ISO time behind `received`, for the `time` element.
planstring | null- Default
null - What the plan will do, as one sentence. Without it the card only offers to dismiss.
reasonstring | null- Why the model wasn't sure.
errorstring | null- A failed attempt, shown on the card.
labelsPartial<TriagePlanLabels>onApproverequired() => void | Promise<void>- Run the plan. The buttons stay unavailable until it settles.
onPickrequired(task: string) => void | Promise<void>- Run a task the person typed instead of the plan.
onDismissrequired() => void | Promise<void>classstring
| Prop | Type | Default |
|---|---|---|
sender required Who sent the email. | string | |
subject required | string | |
snippet The first lines of the body. | string | |
received When it arrived, as text the host already formatted. | string | null | |
receivedAt The ISO time behind `received`, for the `time` element. | string | null | |
plan What the plan will do, as one sentence. Without it the card only offers to dismiss. | string | null | null |
reason Why the model wasn't sure. | string | null | |
error A failed attempt, shown on the card. | string | null | |
labels | Partial<TriagePlanLabels> | |
onApprove required Run the plan. The buttons stay unavailable until it settles. | () => void | Promise<void> | |
onPick required Run a task the person typed instead of the plan. | (task: string) => void | Promise<void> | |
onDismiss required | () => void | Promise<void> | |
class | string |
TriageTask
senderrequiredstringsubjectrequiredstringoutcomerequiredTriageOutcome- What happened to the email.
taskTriageTaskLink | null- The task it became.
whenrequiredstring- When it settled, as text the host already formatted.
whenAtstring | nulldetailstring | null- Why it failed.
errorstring | nulllabelsPartial<TriageTaskLabels>onUndo() => void | Promise<void>- Takes the change back. The button shows only when this is passed.
classstring
| Prop | Type | Default |
|---|---|---|
sender required | string | |
subject required | string | |
outcome required What happened to the email. | TriageOutcome | |
task The task it became. | TriageTaskLink | null | |
when required When it settled, as text the host already formatted. | string | |
whenAt | string | null | |
detail Why it failed. | string | null | |
error | string | null | |
labels | Partial<TriageTaskLabels> | |
onUndo Takes the change back. The button shows only when this is passed. | () => void | Promise<void> | |
class | string |