Skip to content

🔥 The free & Open Source DocuSign alternative

Remove duplicate code

rishabjasrotiab8e8cd127a58
diff --git a/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js b/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js
index 3cead71f4..07b377d1c 100644
--- a/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js
+++ b/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js
@@ -25,6 +25,7 @@ import Nodata from "./component/Nodata";
import Header from "./component/header";
import RenderPdf from "./component/renderPdf";
import { contractUsers, contactBook } from "../utils/Utils";
+import { modalAlign } from "../utils/Utils";
import { $ } from 'select-dom';
//For signYourself inProgress section signer can add sign and complete doc sign.
function SignYourSelf() {
@@ -996,17 +997,6 @@ function SignYourSelf() {
});
};
- const modalAlign = () => {
- let modalDialog = $('.modal-dialog').getBoundingClientRect();
- let mobileHead = $('.mobileHead').getBoundingClientRect()
- let modal = $('.modal-dialog');
- if (modalDialog.left < mobileHead.left) {
- let leftOffset = mobileHead.left - modalDialog.left;
- modal.style.left = leftOffset + 'px';
- modal.style.top = (window.innerHeight/3) + 'px';
- }
- };
-
return (
<DndProvider backend={HTML5Backend}>
{isLoading.isLoad ? (
diff --git a/microfrontends/SignDocuments/src/Component/recipientSignPdf.js b/microfrontends/SignDocuments/src/Component/recipientSignPdf.js
index 6c7369828..9a1bbab90 100644
--- a/microfrontends/SignDocuments/src/Component/recipientSignPdf.js
+++ b/microfrontends/SignDocuments/src/Component/recipientSignPdf.js
@@ -25,7 +25,7 @@ import Nodata from "./component/Nodata";
import Header from "./component/header";
import RenderPdf from "./component/renderPdf";
import CustomModal from "./component/CustomModal";
-import { $ } from 'select-dom';
+import { modalAlign } from "../utils/Utils";
function EmbedPdfImage() {
const { id, contactBookId } = useParams();
const [isSignPad, setIsSignPad] = useState(false);
@@ -954,17 +954,6 @@ function EmbedPdfImage() {
);
};
- const modalAlign = () => {
- let modalDialog = $('.modal-dialog').getBoundingClientRect();
- let mobileHead = $('.mobileHead').getBoundingClientRect()
- let modal = $('.modal-dialog');
- if (modalDialog.left < mobileHead.left) {
- let leftOffset = mobileHead.left - modalDialog.left;
- modal.style.left = leftOffset + 'px';
- modal.style.top = (window.innerHeight/3) + 'px';
- }
- };
-
return (
<DndProvider backend={HTML5Backend}>
{isLoading.isLoad ? (
diff --git a/microfrontends/SignDocuments/src/utils/Utils.js b/microfrontends/SignDocuments/src/utils/Utils.js
index 0b915423d..2c960ceca 100644
--- a/microfrontends/SignDocuments/src/utils/Utils.js
+++ b/microfrontends/SignDocuments/src/utils/Utils.js
@@ -1,4 +1,5 @@
import axios from "axios";
+import { $ } from 'select-dom';
export async function getBase64FromUrl(url) {
const data = await fetch(url);
@@ -57,7 +58,7 @@ export function onSaveImage(xyPostion, index, signKey, imgWH, image) {
(data, ind) =>
data.key === signKey && data.Width && data.Height && data.SignUrl
);
-
+
if (updateFilter.length > 0) {
let newWidth, newHeight;
@@ -260,3 +261,14 @@ export const contactBookName = async (objectId, className) => {
});
return result;
};
+
+export const modalAlign = () => {
+ let modalDialog = $('.modal-dialog').getBoundingClientRect();
+ let mobileHead = $('.mobileHead').getBoundingClientRect()
+ let modal = $('.modal-dialog');
+ if (modalDialog.left < mobileHead.left) {
+ let leftOffset = mobileHead.left - modalDialog.left;
+ modal.style.left = leftOffset + 'px';
+ modal.style.top = (window.innerHeight/3) + 'px';
+ }
+};
\ No newline at end of file