From d3a603d1158b51724eb9f91515b1a3584912de35 Mon Sep 17 00:00:00 2001 From: prafull-opensignlabs Date: Thu, 31 Oct 2024 17:02:49 +0530 Subject: [PATCH] fix: make documentation url copy and clickable in draft ui --- apps/OpenSign/src/pages/DraftTemplate.js | 43 +++++++++++++++++------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/apps/OpenSign/src/pages/DraftTemplate.js b/apps/OpenSign/src/pages/DraftTemplate.js index 8619cf8c0..dccb2c94a 100644 --- a/apps/OpenSign/src/pages/DraftTemplate.js +++ b/apps/OpenSign/src/pages/DraftTemplate.js @@ -123,8 +123,7 @@ const DraftTemplate = () => { const [isSubscriptionExpired, setIsSubscriptionExpired] = useState(false); const [isAlert, setIsAlert] = useState({ type: "success", msg: "" }); const [isPublic, setIsPublic] = useState(""); - const [copied, setCopied] = useState(false); - // const [isPublicErr, setIsPublicError] = useState(false); + const [isPublicErr, setIsPublicError] = useState(""); const [isAllRoleLinked, setIsAllRolelinked] = useState(false); const [, drop] = useDrop({ accept: "BOX", @@ -730,10 +729,7 @@ const DraftTemplate = () => { if (unlinkSignerIndex === 0 && unlinkSigners === 1) { await saveTemplate(); } else { - // setIsPublicError(true); - alert( - "To make your template public, it must either contain a single role, or, if it includes multiple roles, all additional roles must already be assigned to signers. The unassigned public role should remain empty and must be placed in the first position. \nVisit below link to know more - \nhttps://docs.opensignlabs.com/docs/help/Templates/make-template-public" - ); + setIsPublicError(true); } } else { await saveTemplate(); @@ -1300,16 +1296,13 @@ const DraftTemplate = () => { console.log("error", e); } } else { - // setIsPublicError(true); - alert( - "To make your template public, it must either contain a single role, or, if it includes multiple roles, all additional roles must already be assigned to signers. The unassigned public role should remain empty and must be placed in the first position. \nVisit below link to know more - \nhttps://docs.opensignlabs.com/docs/help/Templates/make-template-public" - ); + setIsPublicError(true); } }; const copytoclipboard = (publicUrl) => { copytoData(publicUrl); - setCopied(true); - setTimeout(() => setCopied(false), 1500); // Reset copied state after 1.5 seconds + setIsAlert({ type: "success", msg: t("copied") }); + setTimeout(() => setIsAlert({ type: "success", msg: "" }), 1500); // Reset copied state after 1.5 seconds }; // `handleSendDocument` is trigger when users are linked to all role @@ -1368,7 +1361,6 @@ const DraftTemplate = () => { } return (
- {copied && {t("copied")}} {publicUrl} @@ -1539,6 +1531,31 @@ const DraftTemplate = () => { )} )} + setIsPublicError(false)} + > +
+

+ To make your template public, it must either contain a + single role, or, if it includes multiple roles, all + additional roles must already be assigned to signers. + The unassigned public role should remain empty and must + be placed in the first position.{" "} +

+

Visit below link to know more -

+

+ copytoclipboard( + "https://docs.opensignlabs.com/docs/help/Templates/publicTemplate" + ) + } + > + https://docs.opensignlabs.com/docs/help/Templates/publicTemplate +

+
+