import { zodResolver } from '@hookform/resolvers/zod' import { AnimatePresence } from 'motion/react' import { useForm, useWatch } from 'react-hook-form' import { Button, Dialog, DialogContent, DialogFooter, DialogHeader, DialogSection, DialogSectionSeparator, DialogTitle, Form, FormControl, FormField, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from 'ui' import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' import { z } from 'zod' import { BUILDING_OPTIONS, CAN_CODE_OPTIONS, SURVEY_ORG_KIND_OPTIONS, ORG_SIZE_DEFAULT, ORG_SIZE_TYPES, } from './OnboardingSurvey.constants' import { OnboardingSurveySelect } from './OnboardingSurveySelect' import { FormSectionCollapse } from '@/components/ui/FormSectionCollapse' const FORM_ID = 'onboarding-survey-follow-up-form' const FormSchema = z.object({ kind: z.string(), size: z.string(), building: z.string(), can_code: z.string(), }) export type OnboardingSurveyFollowUpValues = z.infer const defaultValues: OnboardingSurveyFollowUpValues = { kind: '', size: ORG_SIZE_DEFAULT, building: '', can_code: '', } type OnboardingSurveyFollowUpDialogProps = { open: boolean isSubmitting: boolean /** Skip, or the dialog closing any other way */ onClose: () => void onSubmit: (values: OnboardingSurveyFollowUpValues) => void } export function OnboardingSurveyFollowUpDialog({ open, isSubmitting, onClose, onSubmit, }: OnboardingSurveyFollowUpDialogProps) { const form = useForm({ resolver: zodResolver(FormSchema), defaultValues, }) const [kind, building, canCode] = useWatch({ control: form.control, name: ['kind', 'building', 'can_code'], }) const hasAnswer = kind !== '' || building !== '' || canCode !== '' return ( !isOpen && onClose()}> Tell us about your organization

All questions are optional. Your answers help us improve Supabase.

( )} /> {kind === 'COMPANY' && (
( )} />
)}
( )} />
( )} />
) }