diff --git a/src/client/features/audit/launch/LaunchFormCard.tsx b/src/client/features/audit/launch/LaunchFormCard.tsx index 3ac3a65..2e0cea1 100644 --- a/src/client/features/audit/launch/LaunchFormCard.tsx +++ b/src/client/features/audit/launch/LaunchFormCard.tsx @@ -1,29 +1,17 @@ -import type { FormEvent } from "react"; import { Loader2 } from "lucide-react"; import { MAX_PAGES_LIMIT, MIN_PAGES, - type LaunchFormApi, - type LaunchState, } from "@/client/features/audit/launch/types"; +import type { useLaunchController } from "@/client/features/audit/launch/useLaunchController"; +import { getFieldError, getFormError } from "@/client/lib/forms"; -export function LaunchFormCard({ - launchForm, - state, - setState, - isPending, - onSubmit, - onRunLighthouseToggle, - commitMaxPagesInput, -}: { - launchForm: LaunchFormApi; - state: LaunchState; - setState: React.Dispatch>; - isPending: boolean; - onSubmit: (event: FormEvent) => void; - onRunLighthouseToggle: (checked: boolean) => void; +type Props = { + launchForm: ReturnType["launchForm"]; commitMaxPagesInput: () => number; -}) { +}; + +export function LaunchFormCard({ commitMaxPagesInput, launchForm }: Props) { return (
@@ -31,65 +19,68 @@ export function LaunchFormCard({
{ + event.preventDefault(); + void launchForm.handleSubmit(); + }} > - + + {(field) => { + const urlError = getFieldError(field.state.meta.errors); - )} - +
- +
- +
); } -function LaunchOptions({ - launchForm, - commitMaxPagesInput, -}: { - launchForm: LaunchFormApi; - commitMaxPagesInput: () => number; -}) { +function LaunchOptions({ launchForm, commitMaxPagesInput }: Props) { return (