import { Fragment } from "react"; import type { MetadataHistoryView, MetadataKeyChangeView, MetadataValueView, } from "yt-dlp-transcript-common/views/metadataHistoryView"; // WHAT CHANGED EACH TIME THE METADATA WAS REWRITTEN (release 10 slice N). // // Drawn in the page header, beside the Description, because it is about the // same thing: the video's metadata as the source reports it. One line — how // often, how lately, by what, and what moved — and the entries behind it, // newest first. Read-only and server-rendered: the view // (views/metadataHistoryView.ts) is already folded, so there is no client // state and no control. const KIND_NOTE: Record = { changed: "", added: " (new)", removed: " (gone)", counter: "", }; function Value({ v }: { v: MetadataValueView | null }) { if (!v) return —; return ( {v.text} ); } export function MetadataHistoryDetails({ view }: { view: MetadataHistoryView }) { return (
{view.line}
    {view.entries.map((e, i) => (
  1. {e.atLabel} {` · by ${e.by}`} {e.requestedBy ? ` for ${e.requestedBy}` : ""} {` · ${e.summary}`}
    {e.changes.length > 0 && (
    {e.changes.map((c) => (
    {c.key} {KIND_NOTE[c.kind]}
    →
    ))}
    )} {e.volatile.length > 0 && (
    Also moved (compared by fingerprint only): {e.volatile.join(", ")}
    )}
  2. ))}
); }