"use client"; import { useState } from "react"; import { StreamActionLog } from "yt-dlp-transcript-common/components/StreamActionLog"; import { cancelJobAction } from "../../../jobs/actions"; import { capturePostsAction } from "../socialActions"; import { importPostAction } from "../importPostAction"; // A posts channel's ops-only operations as buttons (release 32): one post // imported by its URL (`import-post`), and specific posts captured — a // screenshot and their media (`capture-posts`). On an X channel // (`captureThread` given: the channel's default), a reply's thread shot too -- // the post it answers over it, its author blurred unless verified or the // reply's own, or not blurred when the operator unticks the blur. export function SocialPostTools({ slug, captureThread }: { slug: string; captureThread?: boolean }) { const [url, setUrl] = useState(""); const [ids, setIds] = useState(""); const [shots, setShots] = useState(true); const [media, setMedia] = useState(true); const [force, setForce] = useState(false); const [thread, setThread] = useState(captureThread ?? false); const [blur, setBlur] = useState(true); const x = captureThread !== undefined; const idList = ids.split(/[\s,]+/).filter(Boolean); const input = "rounded border border-border bg-card px-2 py-1 text-sm font-mono"; return (

Import one post

setUrl(e.target.value)} aria-label="post URL" placeholder="https://…" className={`${input} w-[32rem] max-w-full`} /> importPostAction(slug, url.trim())} cancelAction={cancelJobAction} buttonLabel="Import post" runningLabel="Importing…" label={`Import post into ${slug}`} disabled={!url.trim()} />

Capture posts

setIds(e.target.value)} aria-label="post ids to capture" placeholder="post ids, comma or space separated" className={`${input} w-[32rem] max-w-full`} />
{x && ( )} {x && thread && ( )}
capturePostsAction(slug, idList, undefined, shots, media, force, undefined, x ? { thread, ...(thread && !blur ? { threadRedact: false } : {}) } : {}) } cancelAction={cancelJobAction} buttonLabel={`Capture ${idList.length || ""} post${idList.length === 1 ? "" : "s"}`.replace(" ", " ")} runningLabel="Capturing…" label={`Capture posts of ${slug}`} disabled={idList.length === 0} />
); }