"use client"; import { useState, useTransition } from "react"; import Link from "next/link"; import { formatBytes } from "yt-dlp-transcript-common/lib/format"; import { mediaScanKey, type MediaScanFinding, } from "yt-dlp-transcript-common/lib/mediaScan"; import { reviewMediaFindingAction } from "../actions"; const VERDICT_LABEL: Record = { ok: "ok", unreadable: "unreadable", truncated: "truncated", stray: "stray file", unknown: "could not tell", }; const VERDICT_HELP: Record = { ok: "", unreadable: "ffprobe could not parse the container at all. This file cannot be transcribed or diarized from.", truncated: "Decodes, but is materially shorter than the metadata says — the download was cut off.", stray: "Readable media that is not one of the app's own outputs: a leftover scratch or temp file taking up disk.", unknown: "The scan could not reach a conclusion. Nothing is claimed about this file.", }; export function MediaScanFindingRow({ finding, reviewed, }: { finding: MediaScanFinding; reviewed: boolean; }) { const [pending, startTransition] = useTransition(); const [error, setError] = useState(null); const key = mediaScanKey(finding); function toggle() { setError(null); startTransition(async () => { const r = await reviewMediaFindingAction(key, !reviewed); if (!r.ok) setError(r.error); }); } return (
  • {VERDICT_LABEL[finding.verdict]} tier {finding.tier} · {formatBytes(finding.bytes)} {reviewed && ( · marked reviewed )}

    {finding.slug} {" "} {finding.file}

    {VERDICT_HELP[finding.verdict]}

    {(finding.containerSeconds !== null || finding.metadataSeconds !== null) && (

    container{" "} {finding.containerSeconds === null ? "unreadable" : `${Math.round(finding.containerSeconds)}s`}{" "} · metadata{" "} {finding.metadataSeconds === null ? "unknown" : `${Math.round(finding.metadataSeconds)}s`}

    )} {finding.detail && (

    {finding.detail}

    )}
    {/* Deletion is deliberately NOT here. The convention in this app is report first, delete second: the per-file delete already exists on the video page, behind its own confirm, and a scan that could delete what it flagged would be a very different and much more dangerous thing than a scan. */} {error && ( {error} )}
  • ); }