papertrail/components/DownloadReport.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

40 lines
1.3 KiB
TypeScript

"use client";
import { ReportInput, toMarkdownReport } from "@/lib/reportExport";
import { toHtmlReport } from "@/lib/reportExportHtml";
function downloadFile(filename: string, content: string, type: string) {
const blob = new Blob([content], { type });
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = filename;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
}
/**
* Client-side provenance report download — no server round-trip, no LLM cost.
* Builds the Markdown / printable-HTML report from the already-rendered result.
*/
export function DownloadReport({ input }: { input: ReportInput }) {
return (
<div className="flex flex-wrap gap-2">
<button
onClick={() => downloadFile("papertrail-report.md", toMarkdownReport(input), "text/markdown")}
className="rounded-md border border-ink/15 bg-white px-3 py-1.5 text-sm text-ink/70 hover:bg-ink/5"
>
Download report (.md)
</button>
<button
onClick={() => downloadFile("papertrail-report.html", toHtmlReport(input), "text/html")}
className="rounded-md border border-ink/15 bg-white px-3 py-1.5 text-sm text-ink/70 hover:bg-ink/5"
>
Printable (.html)
</button>
</div>
);
}