>({
+ rejected: [],
+ candidates: [],
+ unmatched: [],
+ done_today: [],
+ });
+
+ function setLaneSelected(lane: LaneKey, ids: string[]) {
+ setSelected((prev) => ({ ...prev, [lane]: ids }));
+ }
+
+ async function onResubmit() {
+ if (selected.rejected.length === 0) return;
+ await resubmitRejected(selected.rejected);
+ setSelected((prev) => ({ ...prev, rejected: [] }));
+ await refetch();
+ }
+
+ async function onDismiss() {
+ if (selected.candidates.length === 0) return;
+ // Pair each selected remit with its first candidate claim (the row's
+ // top match). This matches the dismiss UX described in the spec: the
+ // user has already seen the top score, so we trust it for dismissal.
+ const pairs: Array<{ claim_id: string; remit_id: string }> = [];
+ for (const r of lanes.candidates) {
+ if (!selected.candidates.includes(rowKey(r))) continue;
+ const top = r.candidates[0];
+ if (top) pairs.push({ claim_id: top.claim_id, remit_id: r.id });
+ }
+ if (pairs.length) {
+ await dismissCandidates(pairs);
+ setSelected((prev) => ({ ...prev, candidates: [] }));
+ await refetch();
+ }
+ }
+
+ function onExport(lane: LaneKey) {
+ if (selected[lane].length === 0) return;
+ window.open(exportInboxCsvUrl(lane), "_blank");
+ }
if (loading) {
return (
@@ -38,8 +91,6 @@ export default function Inbox() {
const needEyes =
lanes.rejected.length + lanes.candidates.length + lanes.unmatched.length;
- const noop = (_r: LaneRow) => {};
-
return (
-
-
-
-
+ {}}
+ onSelectionChange={(ids) => setLaneSelected("rejected", ids)}
+ />
+ {}}
+ onSelectionChange={(ids) => setLaneSelected("candidates", ids)}
+ />
+ {}}
+ onSelectionChange={(ids) => setLaneSelected("unmatched", ids)}
+ />
+ {}}
+ onSelectionChange={(ids) => setLaneSelected("done_today", ids)}
+ />
+
+ {/* Per-lane bulk bars. Each shows when its lane has a selection. */}
+ {}}
+ onExport={() => onExport("rejected")}
+ />
+ {}}
+ onDismiss={onDismiss}
+ onExport={() => onExport("candidates")}
+ />
+ {}}
+ onDismiss={() => {}}
+ onExport={() => onExport("unmatched")}
+ />
+ {}}
+ onDismiss={() => {}}
+ onExport={() => onExport("done_today")}
+ />
);
}