Skip to content

Commit d3a603d

Browse files
fix: make documentation url copy and clickable in draft ui
1 parent b8fb626 commit d3a603d

File tree

1 file changed

+30
-13
lines changed

1 file changed

+30
-13
lines changed

apps/OpenSign/src/pages/DraftTemplate.js

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ const DraftTemplate = () => {
123123
const [isSubscriptionExpired, setIsSubscriptionExpired] = useState(false);
124124
const [isAlert, setIsAlert] = useState({ type: "success", msg: "" });
125125
const [isPublic, setIsPublic] = useState("");
126-
const [copied, setCopied] = useState(false);
127-
// const [isPublicErr, setIsPublicError] = useState(false);
126+
const [isPublicErr, setIsPublicError] = useState("");
128127
const [isAllRoleLinked, setIsAllRolelinked] = useState(false);
129128
const [, drop] = useDrop({
130129
accept: "BOX",
@@ -730,10 +729,7 @@ const DraftTemplate = () => {
730729
if (unlinkSignerIndex === 0 && unlinkSigners === 1) {
731730
await saveTemplate();
732731
} else {
733-
// setIsPublicError(true);
734-
alert(
735-
"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"
736-
);
732+
setIsPublicError(true);
737733
}
738734
} else {
739735
await saveTemplate();
@@ -1300,16 +1296,13 @@ const DraftTemplate = () => {
13001296
console.log("error", e);
13011297
}
13021298
} else {
1303-
// setIsPublicError(true);
1304-
alert(
1305-
"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"
1306-
);
1299+
setIsPublicError(true);
13071300
}
13081301
};
13091302
const copytoclipboard = (publicUrl) => {
13101303
copytoData(publicUrl);
1311-
setCopied(true);
1312-
setTimeout(() => setCopied(false), 1500); // Reset copied state after 1.5 seconds
1304+
setIsAlert({ type: "success", msg: t("copied") });
1305+
setTimeout(() => setIsAlert({ type: "success", msg: "" }), 1500); // Reset copied state after 1.5 seconds
13131306
};
13141307

13151308
// `handleSendDocument` is trigger when users are linked to all role
@@ -1368,7 +1361,6 @@ const DraftTemplate = () => {
13681361
}
13691362
return (
13701363
<div className="flex flex-row justify-between items-center mb-1 mx-1">
1371-
{copied && <Alert type="success">{t("copied")}</Alert>}
13721364
<span className="w-[220px] md:w-[300px] whitespace-nowrap overflow-hidden text-ellipsis">
13731365
{publicUrl}
13741366
</span>
@@ -1539,6 +1531,31 @@ const DraftTemplate = () => {
15391531
)}
15401532
</ModalUi>
15411533
)}
1534+
<ModalUi
1535+
isOpen={isPublicErr}
1536+
handleClose={() => setIsPublicError(false)}
1537+
>
1538+
<div className="m-4">
1539+
<p>
1540+
To make your template public, it must either contain a
1541+
single role, or, if it includes multiple roles, all
1542+
additional roles must already be assigned to signers.
1543+
The unassigned public role should remain empty and must
1544+
be placed in the first position.{" "}
1545+
</p>
1546+
<p>Visit below link to know more - </p>
1547+
<p
1548+
className="op-link op-link-primary"
1549+
onClick={() =>
1550+
copytoclipboard(
1551+
"https://docs.opensignlabs.com/docs/help/Templates/publicTemplate"
1552+
)
1553+
}
1554+
>
1555+
https://docs.opensignlabs.com/docs/help/Templates/publicTemplate
1556+
</p>
1557+
</div>
1558+
</ModalUi>
15421559
<ModalUi
15431560
isOpen={isShowEmail}
15441561
title={t("signers-alert")}

0 commit comments

Comments
 (0)