"use client"; import { useActionState } from "react"; import { setChannelCadencesAction, type SaveResult } from "../../../scheduler/actions"; import { DurationField } from "../../../components/DurationField"; import { FULL_SWEEP_PRESETS, SYNC_INTERVAL_PRESETS, } from "../../../scheduler/intervalPresets"; // Sticky footer bar that appears once rows are selected. Both fields default to // "Leave unchanged", so sweeps can be retuned across forty channels without // disturbing anyone's auto-sync — the whole reason this page is the right place // for a per-channel override on a corpus where one channel wants a weekly sweep // and everything else wants a daily one. export function BulkCadenceBar({ slugs, onClear, onApplied, }: { slugs: string[]; onClear: () => void; onApplied: () => void; }) { const [state, formAction, pending] = useActionState< SaveResult | undefined, FormData >(async (prev, formData) => { const result = await setChannelCadencesAction(slugs, prev, formData); if (result.ok) onApplied(); return result; }, undefined); return (
{slugs.length} selected
{state?.ok === true && ( Applied. )} {state?.ok === false && ( {state.error} )}
); }