import { arktypeResolver } from "@hookform/resolvers/arktype"; import { type } from "arktype"; import { useForm } from "react-hook-form"; import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, } from "~/client/components/ui/form"; import { Input } from "~/client/components/ui/input"; const restoreSnapshotFormSchema = type({ path: "string?", include: "string?", exclude: "string?", }); export type RestoreSnapshotFormValues = typeof restoreSnapshotFormSchema.inferIn; type Props = { formId: string; onSubmit: (values: RestoreSnapshotFormValues) => void; className?: string; }; export const RestoreSnapshotForm = ({ formId, onSubmit, className }: Props) => { const form = useForm({ resolver: arktypeResolver(restoreSnapshotFormSchema), defaultValues: { path: "", include: "", exclude: "", }, }); const handleSubmit = (values: RestoreSnapshotFormValues) => { onSubmit(values); }; return (
( Path (Optional) Restore only a specific path from the snapshot (leave empty to restore all) )} /> ( Include Patterns (Optional) Include only files matching these patterns (comma-separated) )} /> ( Exclude Patterns (Optional) Exclude files matching these patterns (comma-separated) )} />
); };