Allow reprocessing any card, not just errored ones

The Reprocess button and dropdown item were only visible for cards
with ocrStatus "error". Now they appear for any card that isn't
currently processing, so users can re-run OCR on completed cards too
(e.g. after changing AI settings).

Made-with: Cursor
This commit is contained in:
Randall Stillwell 2026-03-12 12:36:22 -05:00
parent 9f6e9c3c40
commit 9ea9ca741c
3 changed files with 4 additions and 4 deletions

View file

@ -14,9 +14,9 @@ export async function POST(
return NextResponse.json({ error: "Card not found" }, { status: 404 });
}
if (card.ocrStatus !== "error") {
if (card.ocrStatus === "processing") {
return NextResponse.json(
{ error: `Cannot reprocess card with status "${card.ocrStatus}"` },
{ error: "Card is already being processed" },
{ status: 400 }
);
}

View file

@ -253,7 +253,7 @@ export default function CardDetailPage() {
<Header title={String(card.name || "Unnamed Card")} icon={ScanLine}>
<div className="flex flex-wrap gap-2">
{ocrStatus === "error" && (
{ocrStatus !== "processing" && (
<Button variant="outline" size="sm" className="rounded-xl" onClick={handleReprocess} disabled={reprocessing}>
{reprocessing ? (
<><Loader2 className="mr-1 size-4 animate-spin" /> Reprocessing...</>

View file

@ -312,7 +312,7 @@ export function createColumns(actions?: ColumnActions): ColumnDef<ResponseCard>[
</DropdownMenuItem>
)}
{actions?.onReprocess &&
row.original.ocrStatus === "error" && (
row.original.ocrStatus !== "processing" && (
<DropdownMenuItem
onClick={() => actions.onReprocess?.(row.original)}
>