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

56 lines
1.6 KiB
TypeScript

"use client";
import { useEffect, useState } from "react";
import { getLocalHistory, clearLocalHistory } from "@/lib/localHistory";
interface LocalHistoryProps {
onSelect: (claim: string) => void;
}
function truncate(text: string, max = 60): string {
if (text.length <= max) return text;
return `${text.slice(0, max - 1).trimEnd()}…`;
}
export function LocalHistory({ onSelect }: LocalHistoryProps) {
const [history, setHistory] = useState<string[]>([]);
useEffect(() => {
setHistory(getLocalHistory());
}, []);
if (history.length === 0) return null;
return (
<div className="flex flex-col gap-2">
<div className="flex items-center justify-between">
<span className="text-xs font-medium text-ink/60">Recent checks</span>
<button
type="button"
onClick={() => {
clearLocalHistory();
setHistory([]);
}}
className="text-xs text-ink/40 hover:text-accent focus:text-accent focus:outline-none"
>
Clear
</button>
</div>
<ul className="flex flex-wrap gap-2">
{history.map((claim) => (
<li key={claim}>
<button
type="button"
title={claim}
onClick={() => onSelect(claim)}
className="rounded-full border border-ink/10 bg-white px-3 py-1 text-xs text-ink/70 hover:border-accent hover:text-accent focus:border-accent focus:outline-none"
>
{truncate(claim)}
</button>
</li>
))}
</ul>
</div>
);
}