From a6270a605a6bca8159b0de8fd43a4df4ea70064b Mon Sep 17 00:00:00 2001 From: Randall Stillwell Date: Thu, 12 Mar 2026 10:46:15 -0500 Subject: [PATCH] Add reprocess action to data table row dropdown Cards with OCR error status now show a "Reprocess" option in the row actions dropdown menu on the dashboard, triggering the existing reprocess API endpoint. Made-with: Cursor --- src/components/cards/columns.tsx | 11 +++++++++++ src/components/cards/dashboard-content.tsx | 17 +++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/components/cards/columns.tsx b/src/components/cards/columns.tsx index ec6f82f..459981d 100644 --- a/src/components/cards/columns.tsx +++ b/src/components/cards/columns.tsx @@ -9,6 +9,7 @@ import { ArrowUpDown, ArrowUp, ArrowDown, + RefreshCw, } from "lucide-react"; import { Badge } from "@/components/ui/badge"; @@ -106,6 +107,7 @@ function getConfidenceClass(confidence: number | null): string { export type ColumnActions = { onViewDetails?: (card: ResponseCard) => void; onMarkReviewed?: (card: ResponseCard) => void; + onReprocess?: (card: ResponseCard) => void; onDelete?: (card: ResponseCard) => void; }; @@ -309,6 +311,15 @@ export function createColumns(actions?: ColumnActions): ColumnDef[ Mark reviewed )} + {actions?.onReprocess && + row.original.ocrStatus === "error" && ( + actions.onReprocess?.(row.original)} + > + + Reprocess + + )} {actions?.onDelete && ( { + try { + const res = await fetch(`/api/cards/${card.id}/reprocess`, { + method: "POST", + }); + if (!res.ok) { + const err = await res.json(); + throw new Error(err.error || "Failed to start reprocessing"); + } + toast.success("Reprocessing started"); + fetchCards(); + } catch (err) { + toast.error( + err instanceof Error ? err.message : "Failed to start reprocessing" + ); + } + }, onDelete: async (card) => { await fetch(`/api/cards/${card.id}`, { method: "DELETE" }); toast.success("Card deleted");