"use client"; import { useActionState, useState } from "react"; import { StreamActionLog } from "yt-dlp-transcript-common/components/StreamActionLog"; import { SYNC_INTERVAL_MAX_MINUTES } from "yt-dlp-transcript-common/lib/channelConfig"; import { cancelJobAction } from "../../jobs/actions"; import { DurationField } from "../../components/DurationField"; import { backupSavedVideosAction, saveSavedVideoBackupAction, verifySavedVideoBackupAction, type SaveBackupConfigResult, } from "../backupActions"; import { seedChecked } from "../../lib/formState"; type Props = { enabled: boolean; dest: string; intervalMinutes: number; }; // Backup config form + run/verify buttons for the Saved Videos page. The // destination drives all three: with no dest, scheduled and manual backups are // both disabled. export function SavedVideosControls({ enabled, dest, intervalMinutes }: Props) { const [state, formAction] = useActionState< SaveBackupConfigResult | undefined, FormData >(saveSavedVideoBackupAction, undefined); // Track the dest input live so the run/verify buttons enable/disable without a // round-trip. Seeded from the saved value. const [destInput, setDestInput] = useState(dest); const hasDest = destInput.trim() !== ""; return (
Set a backup destination above and save to enable backups.
)}