"use client"; import { useActionState } from "react"; import type { SyncSchedulerSettings } from "yt-dlp-transcript-common/lib/settings"; import { saveSchedulerSettingsAction, type SaveResult, } from "../../../scheduler/actions"; import { SYNC_INTERVAL_MAX_MINUTES, SYNC_INTERVAL_MIN_MINUTES, } from "yt-dlp-transcript-common/lib/channelConfig"; import { DurationField } from "../../../components/DurationField"; import { Field } from "../../../components/forms/Field"; import { seedChecked } from "../../../lib/formState"; import { FULL_SWEEP_PRESETS } from "../../../scheduler/intervalPresets"; // THE SYNC OPERATION'S SETTINGS BLOCK, whole. It is the form the descriptor's // `settingsBlock: "syncScheduler"` selects, drawn below the schedule on // /operations/sync. // // It was half a form here and a fieldset on /settings, which meant TWO writers // of one block — and the only thing keeping them from clobbering each other was // that both remembered to preserve the fields their own render did not show. // One block, one page, one writer (saveSchedulerSettingsAction); /settings // preserves it the way it preserves digest, diarization and the lane. // // `heartbeatSeconds` is the live EFFECTIVE value passed from the page // (resolveHeartbeatSeconds), not the stored one: SYNC_HEARTBEAT_SECONDS // overrides the setting, and a field showing the stored number beside a server // running a different cadence is a lie the operator cannot see. export function SchedulerSettingsForm({ scheduler, heartbeatSeconds, }: { scheduler: SyncSchedulerSettings; heartbeatSeconds: number; }) { const [state, formAction, pending] = useActionState< SaveResult | undefined, FormData >(saveSchedulerSettingsAction, undefined); return (
); }