From 73e7fca49ae7c013e9b4c82228afa709da1929a7 Mon Sep 17 00:00:00 2001 From: Timur Ercan Date: Thu, 9 Mar 2023 11:01:42 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8=20free=20sign=20hint=20and=20ux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/components/editor/pdf-signer.tsx | 87 +++++++++++++++-------- 1 file changed, 59 insertions(+), 28 deletions(-) diff --git a/apps/web/components/editor/pdf-signer.tsx b/apps/web/components/editor/pdf-signer.tsx index 3448772d6..83889f334 100644 --- a/apps/web/components/editor/pdf-signer.tsx +++ b/apps/web/components/editor/pdf-signer.tsx @@ -5,7 +5,10 @@ import dynamic from "next/dynamic"; import SignatureDialog from "./signature-dialog"; import { useEffect, useState } from "react"; import { Button } from "@documenso/ui"; -import { CheckBadgeIcon } from "@heroicons/react/24/outline"; +import { + CheckBadgeIcon, + InformationCircleIcon, +} from "@heroicons/react/24/outline"; import toast from "react-hot-toast"; import { FieldType } from "@prisma/client"; import { @@ -25,6 +28,9 @@ export default function PDFSigner(props: any) { const [signingDone, setSigningDone] = useState(false); const [localSignatures, setLocalSignatures] = useState([]); const [fields, setFields] = useState(props.fields); + const signatureFieldCount: number = fields.filter( + (field) => field.type === FieldType.SIGNATURE + ).length; const [dialogField, setDialogField] = useState(); useEffect(() => { @@ -75,46 +81,71 @@ export default function PDFSigner(props: any) {
- +
-
+

- Timur Ercan (timur.ercan31@gmail.com) would like you to sign this - document. + {props.document.User.name + ? `${props.document.User.name} (${props.document.User.email})` + : props.document.User.email}{" "} + would like you to sign this document. +

+

+

-
+ {signatureFieldCount === 0 ? ( +
+
+
+
+
+

+ You can sign this document anywhere you like, but maybe look for + a signature line. +

+
+
+
+ ) : null} field.type === FieldType.SIGNATURE) - .length === 0 - ) + if (signatureFieldCount === 0) addFreeSignature(e, page, props.recipient); }} onMouseUp={() => {}}