"use client"; import { useActionState, useState } from "react"; import { Checkbox, Select } from "@unlocalhosted/metalui"; import type { FormState } from "@/app/actions/types"; import { MergeIcon } from "@/components/icons"; import { Alert, Button } from "@/components/ui"; const METHODS = [ { value: "merge", label: "Create a merge commit" }, { value: "squash", label: "Squash and merge" }, ] as const; /** The merge button with its method, and whether to delete the head branch afterwards. */ export function MergeForm({ action, headSha, mergeable, canDeleteBranch, }: { action: (prev: FormState, formData: FormData) => Promise; headSha: string; mergeable: boolean; canDeleteBranch: boolean; }) { const [state, formAction, pending] = useActionState(action, undefined); const [method, setMethod] = useState<"merge" | "squash">("merge"); return (