diff --git a/apps/web/src/app/(signing)/sign/[token]/provider.tsx b/apps/web/src/app/(signing)/sign/[token]/provider.tsx index 6531e8a40..454007cb0 100644 --- a/apps/web/src/app/(signing)/sign/[token]/provider.tsx +++ b/apps/web/src/app/(signing)/sign/[token]/provider.tsx @@ -9,8 +9,6 @@ export type SigningContextValue = { setEmail: (_value: string) => void; signature: string | null; setSignature: (_value: string | null) => void; - customText: string; - setCustomText: (_value: string) => void; }; const SigningContext = createContext(null); @@ -33,7 +31,6 @@ export interface SigningProviderProps { fullName?: string | null; email?: string | null; signature?: string | null; - customText?: string | null; children: React.ReactNode; } @@ -41,13 +38,11 @@ export const SigningProvider = ({ fullName: initialFullName, email: initialEmail, signature: initialSignature, - customText: initialCustomText, children, }: SigningProviderProps) => { const [fullName, setFullName] = useState(initialFullName || ''); const [email, setEmail] = useState(initialEmail || ''); const [signature, setSignature] = useState(initialSignature || null); - const [customText, setCustomText] = useState(initialCustomText || ''); return ( {children} diff --git a/apps/web/src/app/(signing)/sign/[token]/text-field.tsx b/apps/web/src/app/(signing)/sign/[token]/text-field.tsx index 50a65f4b4..11bb11342 100644 --- a/apps/web/src/app/(signing)/sign/[token]/text-field.tsx +++ b/apps/web/src/app/(signing)/sign/[token]/text-field.tsx @@ -15,7 +15,6 @@ import { Label } from '@documenso/ui/primitives/label'; import { Textarea } from '@documenso/ui/primitives/textarea'; import { useToast } from '@documenso/ui/primitives/use-toast'; -import { useRequiredSigningContext } from './provider'; import { SigningFieldContainer } from './signing-field-container'; export type TextFieldProps = { @@ -27,8 +26,6 @@ export const TextField = ({ field, recipient }: TextFieldProps) => { const router = useRouter(); const { toast } = useToast(); - const { customText: providedCustomText, setCustomText: setProvidedCustomText } = - useRequiredSigningContext(); const [isPending, startTransition] = useTransition(); @@ -52,31 +49,25 @@ export const TextField = ({ field, recipient }: TextFieldProps) => { } }, [showCustomTextModal, isLocalSignatureSet]); - const onSign = async (source: 'local' | 'provider' = 'provider') => { + const onSign = async () => { try { - if (!providedCustomText && !localText) { + if (!localText) { setIsLocalSignatureSet(false); setShowCustomTextModal(true); return; } - const value = source === 'local' && localText ? localText : providedCustomText ?? ''; - - if (!value) { + if (!localText) { return; } await signFieldWithToken({ token: recipient.token, fieldId: field.id, - value, + value: localText, isBase64: true, }); - if (source === 'local' && !providedCustomText) { - setProvidedCustomText(localText); - } - setLocalCustomText(''); startTransition(() => router.refresh()); @@ -93,9 +84,6 @@ export const TextField = ({ field, recipient }: TextFieldProps) => { const onRemove = async () => { try { - // Necessary to reset the custom text if the user removes the signature - setProvidedCustomText(''); - await removeSignedFieldWithToken({ token: recipient.token, fieldId: field.id, @@ -164,7 +152,7 @@ export const TextField = ({ field, recipient }: TextFieldProps) => { onClick={() => { setShowCustomTextModal(false); setIsLocalSignatureSet(true); - void onSign('local'); + void onSign(); }} > Save Text