'use client'; import { useState } from 'react'; import { Caveat } from 'next/font/google'; import { Check, ChevronsUpDown } from 'lucide-react'; import { Control, FieldErrors, UseFormWatch } from 'react-hook-form'; import { cn } from '@documenso/ui/lib/utils'; import { Button } from '@documenso/ui/primitives/button'; import { Card, CardContent } from '@documenso/ui/primitives/card'; import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, } from '@documenso/ui/primitives/command'; import { Popover, PopoverContent, PopoverTrigger } from '@documenso/ui/primitives/popover'; import { TEditDocumentFormSchema } from './types'; const fontCaveat = Caveat({ weight: ['500'], subsets: ['latin'], display: 'swap', variable: '--font-caveat', }); export type AddFieldsFormProps = { className?: string; control: Control; watch: UseFormWatch; errors: FieldErrors; isSubmitting: boolean; theme: string; }; export const AddFieldsFormPartial = ({ className, control: _control, watch, errors: _errors, isSubmitting: _isSubmitting, theme, }: AddFieldsFormProps) => { const signers = watch('signers'); const [selectedSigner, setSelectedSigner] = useState(() => signers[0]); return (

Edit Document

Add all relevant fields for each recipient.


{signers.map((signer, index) => ( setSelectedSigner(signer)}> {signer.name && ( {signer.name} ({signer.email}) )} {!signer.name && {signer.email}} ))}
); };