"use client" import { z } from "zod" import { zodResolver } from "@hookform/resolvers/zod" import { useForm } from "react-hook-form" import { Button } from "@/components/ui/button" import { toast } from "@/components/ui/use-toast" import { Form, FormItem, FormLabel, FormField, FormControl, FormDescription, FormMessage } from "@/components/ui/form" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select" import { ItemText, SelectItemIndicator, SelectItemText } from "@radix-ui/react-select" const FormSchema = z.object({ storyId: z.string(), pubId: z.string(), // submitted: z.date(), // responded: z.date(), // responseId: z.string() }) export default function SubmissionForm({ stories, pubs, responses }) { const form = useForm>({ resolver: zodResolver(FormSchema), }) const storiesSelectItems = stories.map(e => ( {e.title} )) const pubsSelectItems = pubs.map(e => ( {e.title} )) const reponsesSelectItems = responses.map(e => ( {e.response} )) // 2. Define a submit handler. function onSubmit(values: z.infer) { // Do something with the form values. // ✅ This will be type-safe and validated. toast({ title: "You submitted the following values:", description: (
					{JSON.stringify(values, null, 2)}
				
), }) console.log(values) } function onErrors(errors) { toast({ title: "You have errors", description: (
					{JSON.stringify(errors, null, 2)}
				
), }) console.log(JSON.stringify(errors)) } return (
( Story The piece you submitted )} /> ( Publication The market you sent it to )} /> ) }