Select an organization first.
;
}
if (isLoading) {
return
Decisions
{/* Queue quicklinks + date-range chips (§4.1–§4.2). The rail self-hides
when the company has no queues; the chips filter the desk server-side. */}
{
setDateRange(value);
setCustomRange(custom);
}}
/>
{error &&
{(error as Error).message}
}
{!hasAnything ? (
) : (
{visibleCount === 0 ? (
0} />
) : (
<>
{groups.map((group) => {
const groupLabel = group.label;
const collapsed = groupLabel !== null && collapsedGroupKeys.has(group.key);
return (
{groupLabel !== null && (
toggleGroupCollapse(group.key)}
trailing={
{group.items.length}
}
/>
)}
{!collapsed && (
{(() => {
const rows = renderPlan.groupRows.get(group.key) ?? [];
const seenBundles = new Set
();
return rows.map((item) => {
const bundleId =
item.sourceKind === "decision"
? ((item.subject.metadata?.bundleId as string | null | undefined) ?? null)
: null;
let header: ReactNode = null;
if (bundleId && !seenBundles.has(bundleId)) {
seenBundles.add(bundleId);
const bundleRows = rows.filter(
(row) =>
row.sourceKind === "decision" &&
((row.subject.metadata?.bundleId as string | null | undefined) ?? null) === bundleId,
);
const first = bundleRows[0];
header = (
);
}
return (
{header}
);
});
})()}
)}
);
})}
>
)}
{snoozedItems.length > 0 && (
setSnoozedOpen((prev) => !prev)}
>
{renderPlan.snoozedRows.map((item) => (
))}
)}
{dismissedItems.length > 0 && (
setDismissedOpen((prev) => !prev)}
>
{renderPlan.dismissedRows.map((item) => (
))}
)}
{agingItems.length > 0 && (
setAgingOpen((prev) => !prev)}
>
Idle past {ATTENTION_AGING_DAYS} days — kept off the desk. Keep any you still want surfaced.
{agingItems.map((item) => (
))}
)}
)}
setDecidedOpen((prev) => !prev)}
>
{decidedDecisionsLoading ? (
Loading decided decisions…
) : (decidedDecisions?.length ?? 0) > 0 ? (
decidedDecisions!.slice(0, DECISION_HISTORY_VISIBLE_LIMIT).map((decision) => (
))
) : (
No decided decisions.
)}
setExpiredOpen((prev) => !prev)}
>
{expiredDecisionsLoading ? (
Loading expired decisions…
) : (expiredDecisions?.length ?? 0) > 0 ? (
expiredDecisions!.slice(0, DECISION_HISTORY_VISIBLE_LIMIT).map((decision) => (
))
) : (
No expired decisions.
)}
);
}
/**
* Violet left-rule strip over a run of decisions that share a bundle, e.g.
* "Planner proposed 6 decisions · from PAP-123 · routing review · 6 pending".
* Grouping is a surface only — each decision is still decided independently.
*/
export function DecisionBundleHeader({
agentName,
title,
originIssue,
count,
}: {
agentName: string | null;
title: string | null;
originIssue: AttentionSubject | null;
count: number;
}) {
const noun = count === 1 ? "decision" : "decisions";
return (
{filtered ? "No decisions match your search or filters." : "You're all caught up."}
{filtered && (
Adjust or clear your search and filters to see the rest.
)}
);
}
function ZeroState() {
return (