"use client"; import { useActionState } from "react"; import type { AmendTarget } from "yt-dlp-transcript-common/lib/changelog"; import { amendReleaseAction, type AmendReleaseState, } from "../lib/amendReleaseAction"; import { SeededInput, SeededSelect } from "../../components/forms/Field"; import { seedChecked } from "../../lib/formState"; // AMEND THE LATEST RELEASE: re-pick its bump (counted from the release before // it, so a patch cut can become the minor it should have been), its date, fold // in what has gathered under [Unreleased] since — or move it back under // [Unreleased] altogether. The writer is common/controller/cutRelease.ts's // amendRelease; only the newest release can be amended, and the form names // it, so a stale form is refused rather than amending another. export function AmendReleaseForm({ workspace, target, }: { workspace: "editor" | "export"; target: AmendTarget | null; }) { const [state, formAction, pending] = useActionState< AmendReleaseState | undefined, FormData >(amendReleaseAction, undefined); if (!target) { return (
No release to amend yet.
); } const { latest, previous, bumps } = target; const id = (name: string) => `amend-${name}-${workspace}`; // The select's default: the bump the latest release already is, if any. const current = (["patch", "minor", "major"] as const).find((k) => bumps[k] === latest.version) ?? ""; return ( ); }