papertrail/components/import/CommitStep.tsx
caelum0x 695a365ae4 feat: PaperTrail — enterprise evidence-verification platform
Multi-tenant platform (182 pages, 228 API routes, ~30 modules) built on a
deterministic verification core: clinical-trial claims checked against
ClinicalTrials.gov registered results and raw event counts (ARR/NNT/RR+CI
recomputed in code, oracle-tested), code-enforced exact-span grounding, and
multi-source cross-verification. Auth/RBAC/multi-tenancy, document processing
at scale (unpdf + Docling), agentic workflows, Claude Science connector,
compliance/audit, billing, public API, and more.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 07:21:22 +03:00

74 lines
2.2 KiB
TypeScript

"use client";
import Link from "next/link";
import type { ImportBatch } from "@/lib/import/types";
import { BatchStatusBadge } from "./ImportStatusBadge";
// Step 4: the batch has been staged. Offer to commit it now (insert into the
// target table) or review it later from history. Parent owns the commit call.
export function CommitStep({
batch,
committing,
committed,
error,
onCommit,
}: {
batch: ImportBatch;
committing: boolean;
committed: boolean;
error: string | null;
onCommit: () => void;
}) {
return (
<div className="space-y-5">
<div className="rounded-lg border border-ink/10 bg-white p-5">
<div className="flex items-center gap-2">
<h2 className="text-sm font-semibold text-ink/80">Batch staged</h2>
<BatchStatusBadge status={batch.status} />
</div>
<p className="mt-1 text-sm text-ink/60">
{batch.total} row(s) ready to import into{" "}
<span className="font-medium text-ink/80">{batch.target}</span>.
</p>
{committed ? (
<p className="mt-2 text-sm text-emerald-700">
Imported {batch.succeeded} row(s); {batch.failed} failed.
</p>
) : null}
</div>
{error ? (
<p className="rounded border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700">
{error}
</p>
) : null}
<div className="flex justify-between">
<Link
href={`/console/import/${batch.id}`}
className="rounded border border-ink/10 px-4 py-2 text-sm text-ink/60 hover:bg-paper"
>
View batch
</Link>
{!committed ? (
<button
type="button"
onClick={onCommit}
disabled={committing}
className="rounded bg-accent px-4 py-2 text-sm text-white hover:opacity-90 disabled:opacity-50"
>
{committing ? "Committing…" : "Commit now"}
</button>
) : (
<Link
href="/console/import"
className="rounded bg-accent px-4 py-2 text-sm text-white hover:opacity-90"
>
Done
</Link>
)}
</div>
</div>
);
}