"use client"; // A WAYBACK PAGES channel, live (release 37 S5): whether each record's // ORIGINAL is still up (check-post-availability, asked at the original's own // site — never the Wayback Machine), the records whose original is gone (the // Wayback copy is then the only copy), and Save Page Now — "Ask the Wayback // Machine to capture this now" — for a page still up, its capture imported // here. Save Page Now is off without archive.org's S3 keys, and says why. import { useState, useTransition } from "react"; import Link from "next/link"; import { StreamActionLog } from "yt-dlp-transcript-common/components/StreamActionLog"; import { cancelJobAction } from "../../../jobs/actions"; import { checkPostAvailabilityAction } from "../socialActions"; import { savePageNowAction } from "../waybackLiveActions"; export type WaybackLiveRow = { id: string; title: string; originalUrl: string; waybackUrl: string; // posts-availability.json's verdict on the original, when checked. availability?: string; reason?: string; checkedAt?: string; }; export type WaybackLiveState = { // Distinct original URLs, and how many were checked / are gone. originals: number; checked: number; gone: number; unavailable: number; // Records whose original is gone (deleted or unavailable), newest first. goneRows: WaybackLiveRow[]; // Records whose original answered, one per original URL (Save Page Now). liveRows: WaybackLiveRow[]; spn: { on: true; mode: "keys" } | { on: true; mode: "anonymous"; note: string } | { on: false; reason: string }; }; function CaptureNow({ slug, url, disabled }: { slug: string; url: string; disabled: boolean }) { const [pending, start] = useTransition(); const [job, setJob] = useState(null); const [err, setErr] = useState(null); return ( {job && ( job )} {err && ( {err} )} ); } export function WaybackLivePanel({ slug, state }: { slug: string; state: WaybackLiveState }) { const [url, setUrl] = useState(""); const [checkJob, setCheckJob] = useState(null); const [spnJob, setSpnJob] = useState(null); const input = "rounded border border-border bg-card px-2 py-1 text-sm font-mono"; const spnOff = !state.spn.on; return (

Originals

{state.checked} of {state.originals} original URL{state.originals === 1 ? "" : "s"} checked · {state.gone} gone {state.unavailable > 0 ? ` · ${state.unavailable} unavailable` : ""}
checkPostAvailabilityAction(slug)} cancelAction={cancelJobAction} buttonLabel="Check originals" runningLabel="Checking…" label={`Check the originals of ${slug}`} disabled={state.originals === 0} onSettled={(started, out) => setCheckJob(started ? out.jobId : null)} /> {checkJob && ( Open the check job )} {state.goneRows.length > 0 && ( {state.goneRows.map((r) => ( ))}
Page Original Wayback copy
{r.title} {r.availability === "deleted" ? "gone" : "unavailable"} {r.reason && · {r.reason}} the only copy
)}

Save Page Now

{spnOff && (

{state.spn.on ? "" : state.spn.reason}

)} {state.spn.on && state.spn.mode === "anonymous" && (

{state.spn.note}

)} setUrl(e.target.value)} aria-label="page to capture" placeholder="https://…" disabled={spnOff} className={`${input} w-[36rem] max-w-full`} /> savePageNowAction(url.trim(), slug)} cancelAction={cancelJobAction} buttonLabel="Ask the Wayback Machine to capture this now" runningLabel="Capturing…" label={`Save Page Now into ${slug}`} disabled={spnOff || !url.trim()} onSettled={(started, out) => setSpnJob(started ? out.jobId : null)} /> {spnJob && ( Open the capture job )} {state.liveRows.length > 0 && ( )}
); }