import { reportHistoryViewPath, type ClaimChange, type ClaimDiffField, type DiffSegment, type ReportHistoryView, type ReportRevisionView, } from "yt-dlp-transcript-common/lib/report/revisions"; import { reportPagePath } from "yt-dlp-transcript-common/lib/report/views"; import { ReportName, textLink } from "./parts"; // A REPORT'S REVISION HISTORY, from its history.json (common/lib/report/revisions.ts): // how to clone it, then every revision, newest first — its number, date, // commit and report.json sha256 (the hash every export's footer prints), the // change summary, and each changed claim as an inline word diff against the // revision before. const FIELD_LABELS: Record = { title: "Title", text: "Claim", verdict: "Verdict", findings: "Findings", }; const STATUS_LABELS: Record = { added: "added", removed: "removed", edited: "edited", }; // `2026-03-08T12:00:00Z` → `2026-03-08 12:00 UTC`. export function revisionDate(iso: string): string { const m = /^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2})/.exec(iso); return m ? `${m[1]} ${m[2]} UTC` : iso; } function Diff({ segments }: { segments: DiffSegment[] }) { return ( <> {segments.map((s, i) => s.op === "ins" ? ( {s.text} ) : s.op === "del" ? ( {s.text} ) : ( {s.text} ), )} ); } function ClaimDiff({ change }: { change: ClaimChange }) { return (

{change.id} · {change.section} · {STATUS_LABELS[change.status]}

{change.fields.map((f) => (

{FIELD_LABELS[f.field]}

))}
); } function Revision({ r }: { r: ReportRevisionView }) { return (
  • Revision {r.revision}

    {revisionDate(r.date)}

    commit
    {r.commit}
    report sha256
    {r.reportSha256}
    {r.summary.length > 0 && (
      {r.summary.map((line, i) => (
    • {line}
    • ))}
    )} {r.claims.length > 0 && (
    {r.claims.map((c) => ( ))}
    )}
  • ); } export default function ReportHistory({ view }: { view: ReportHistoryView }) { const revisions = [...view.revisions].reverse(); return (

    Revision history

    Every edit to this report, newest first. Each revision is a commit in the report's own git history; its report sha256 is the hash printed at the foot of the report's downloads.{" "} history.json

              git clone {view.clone}
            
      {revisions.map((r) => ( ))}
    ); }