"use client"; import { useActionState } from "react"; import { Checkbox } from "@unlocalhosted/metalui"; import type { FormState } from "@/app/actions/types"; import { PullRequestIcon } from "@/components/icons"; import { TextareaField, TextField } from "@/components/settings-fields"; import { PlateBody, PlateFooter } from "@/components/settings-plate"; import { Alert, Button } from "@/components/ui"; export function CreatePullForm({ action, head, headRepo, base, title, body, }: { action: (prev: FormState, formData: FormData) => Promise; head: string; /** The fork the head branch is on ("owner/name"), when it isn't the repository's own. */ headRepo: string | null; base: string; title: string; body: string; }) { const [state, formAction, pending] = useActionState(action, undefined); return (
{headRepo && } {state?.error && {state.error}}
); }