mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 00:03:33 +10:00
fix: Added signing pad disable state while submitting form (#892)
Fixes : #891
This commit is contained in:
@ -399,6 +399,7 @@ export const Widget = ({ className, children, ...props }: WidgetProps) => {
|
|||||||
</DialogDescription>
|
</DialogDescription>
|
||||||
|
|
||||||
<SignaturePad
|
<SignaturePad
|
||||||
|
disabled={isSubmitting}
|
||||||
className="aspect-video w-full rounded-md border"
|
className="aspect-video w-full rounded-md border"
|
||||||
defaultValue={signatureDataUrl || ''}
|
defaultValue={signatureDataUrl || ''}
|
||||||
onChange={setDraftSignatureDataUrl}
|
onChange={setDraftSignatureDataUrl}
|
||||||
|
|||||||
@ -132,6 +132,7 @@ export const SigningForm = ({ document, recipient, fields }: SigningFormProps) =
|
|||||||
<CardContent className="p-0">
|
<CardContent className="p-0">
|
||||||
<SignaturePad
|
<SignaturePad
|
||||||
className="h-44 w-full"
|
className="h-44 w-full"
|
||||||
|
disabled={isSubmitting}
|
||||||
defaultValue={signature ?? undefined}
|
defaultValue={signature ?? undefined}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
setSignature(value);
|
setSignature(value);
|
||||||
|
|||||||
@ -121,10 +121,8 @@ export const ProfileForm = ({ className, user }: ProfileFormProps) => {
|
|||||||
<FormControl>
|
<FormControl>
|
||||||
<SignaturePad
|
<SignaturePad
|
||||||
className="h-44 w-full"
|
className="h-44 w-full"
|
||||||
containerClassName={cn(
|
disabled={isSubmitting}
|
||||||
'rounded-lg border bg-background',
|
containerClassName={cn('rounded-lg border bg-background')}
|
||||||
isSubmitting ? 'pointer-events-none opacity-50' : null,
|
|
||||||
)}
|
|
||||||
defaultValue={user.signature ?? undefined}
|
defaultValue={user.signature ?? undefined}
|
||||||
onChange={(v) => onChange(v ?? '')}
|
onChange={(v) => onChange(v ?? '')}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -172,6 +172,7 @@ export const SignUpForm = ({ className, isGoogleSSOEnabled }: SignUpFormProps) =
|
|||||||
<FormControl>
|
<FormControl>
|
||||||
<SignaturePad
|
<SignaturePad
|
||||||
className="h-36 w-full"
|
className="h-36 w-full"
|
||||||
|
disabled={isSubmitting}
|
||||||
containerClassName="mt-2 rounded-lg border bg-background"
|
containerClassName="mt-2 rounded-lg border bg-background"
|
||||||
onChange={(v) => onChange(v ?? '')}
|
onChange={(v) => onChange(v ?? '')}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -16,6 +16,7 @@ const DPI = 2;
|
|||||||
export type SignaturePadProps = Omit<HTMLAttributes<HTMLCanvasElement>, 'onChange'> & {
|
export type SignaturePadProps = Omit<HTMLAttributes<HTMLCanvasElement>, 'onChange'> & {
|
||||||
onChange?: (_signatureDataUrl: string | null) => void;
|
onChange?: (_signatureDataUrl: string | null) => void;
|
||||||
containerClassName?: string;
|
containerClassName?: string;
|
||||||
|
disabled?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SignaturePad = ({
|
export const SignaturePad = ({
|
||||||
@ -23,6 +24,7 @@ export const SignaturePad = ({
|
|||||||
containerClassName,
|
containerClassName,
|
||||||
defaultValue,
|
defaultValue,
|
||||||
onChange,
|
onChange,
|
||||||
|
disabled = false,
|
||||||
...props
|
...props
|
||||||
}: SignaturePadProps) => {
|
}: SignaturePadProps) => {
|
||||||
const $el = useRef<HTMLCanvasElement>(null);
|
const $el = useRef<HTMLCanvasElement>(null);
|
||||||
@ -214,7 +216,11 @@ export const SignaturePad = ({
|
|||||||
}, [defaultValue]);
|
}, [defaultValue]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn('relative block', containerClassName)}>
|
<div
|
||||||
|
className={cn('relative block', containerClassName, {
|
||||||
|
'pointer-events-none opacity-50': disabled,
|
||||||
|
})}
|
||||||
|
>
|
||||||
<canvas
|
<canvas
|
||||||
ref={$el}
|
ref={$el}
|
||||||
className={cn('relative block dark:invert', className)}
|
className={cn('relative block dark:invert', className)}
|
||||||
|
|||||||
Reference in New Issue
Block a user