"use client"; import { useState } from "react"; /** * "Throw this batch away" control, shared by both OCR review queues * (recibos and pólizas). * * Confirmation is a two-step inline swap rather than `window.confirm`: the * dialog would block the page, and an accidental discard is not undoable from * the UI — the reviewer should read what they are about to lose, not dismiss * a modal reflexively. * * The card is only rendered when the batch is still discardable; the API * refuses again on its own (a page posted between render and click). */ export function DiscardBatchCard({ busy, onDiscard, pageCount, what, }: { busy: boolean; onDiscard: () => void; pageCount: number; /** Singular noun for what a page becomes — "recibo" / "póliza". */ what: string; }) { const [armed, setArmed] = useState(false); return (

Descartar lote

{armed ? ( <>

Se descartarán las {pageCount} página(s) de este lote y no se creará ninguna {what}. Esto no se puede deshacer desde aquí; para volver a intentarlo hay que subir los PDFs otra vez.

) : ( <>

Si el lote quedó mal (escaneo ilegible, PDFs equivocados, subida duplicada), descártelo para sacarlo de la cola de revisión.

)}
); }