"use client"; import { useState } from "react"; import { StreamActionLog } from "yt-dlp-transcript-common/components/StreamActionLog"; import { cancelJobAction } from "../../jobs/actions"; import { attachArticleVideoAction } from "../lib/attachVideoAction"; // An article's own video (release 32; `archilyzer reports attach-video // --article` before it): a file on this machine, remuxed or encoded to fit the // publish limit, beside the article as video.mp4 with a poster. export function ArticleVideoControl({ articleId, video }: { articleId: string; video: string | null }) { const [file, setFile] = useState(""); const [poster, setPoster] = useState(""); const [caption, setCaption] = useState(""); const input = "rounded border border-border bg-card px-2 py-1 text-sm font-mono"; return (
{video ? `Video: ${video}` : "No video"} · Attach video
attachArticleVideoAction(articleId, { video: file, ...(poster.trim() ? { poster } : {}), ...(caption.trim() ? { caption } : {}) })} cancelAction={cancelJobAction} buttonLabel="Attach video" runningLabel="Attaching…" label={`Attach video to ${articleId}`} disabled={!file.trim()} />
); }