Skip to content

Commit b8e8cd1

Browse files
Remove duplicate code
1 parent 876a2d7 commit b8e8cd1

File tree

3 files changed

+15
-24
lines changed

3 files changed

+15
-24
lines changed

microfrontends/SignDocuments/src/Component/SignYourselfPdf.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import Nodata from "./component/Nodata";
2525
import Header from "./component/header";
2626
import RenderPdf from "./component/renderPdf";
2727
import { contractUsers, contactBook } from "../utils/Utils";
28+
import { modalAlign } from "../utils/Utils";
2829
import { $ } from 'select-dom';
2930
//For signYourself inProgress section signer can add sign and complete doc sign.
3031
function SignYourSelf() {
@@ -996,17 +997,6 @@ function SignYourSelf() {
996997
});
997998
};
998999

999-
const modalAlign = () => {
1000-
let modalDialog = $('.modal-dialog').getBoundingClientRect();
1001-
let mobileHead = $('.mobileHead').getBoundingClientRect()
1002-
let modal = $('.modal-dialog');
1003-
if (modalDialog.left < mobileHead.left) {
1004-
let leftOffset = mobileHead.left - modalDialog.left;
1005-
modal.style.left = leftOffset + 'px';
1006-
modal.style.top = (window.innerHeight/3) + 'px';
1007-
}
1008-
};
1009-
10101000
return (
10111001
<DndProvider backend={HTML5Backend}>
10121002
{isLoading.isLoad ? (

microfrontends/SignDocuments/src/Component/recipientSignPdf.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import Nodata from "./component/Nodata";
2525
import Header from "./component/header";
2626
import RenderPdf from "./component/renderPdf";
2727
import CustomModal from "./component/CustomModal";
28-
import { $ } from 'select-dom';
28+
import { modalAlign } from "../utils/Utils";
2929
function EmbedPdfImage() {
3030
const { id, contactBookId } = useParams();
3131
const [isSignPad, setIsSignPad] = useState(false);
@@ -954,17 +954,6 @@ function EmbedPdfImage() {
954954
);
955955
};
956956

957-
const modalAlign = () => {
958-
let modalDialog = $('.modal-dialog').getBoundingClientRect();
959-
let mobileHead = $('.mobileHead').getBoundingClientRect()
960-
let modal = $('.modal-dialog');
961-
if (modalDialog.left < mobileHead.left) {
962-
let leftOffset = mobileHead.left - modalDialog.left;
963-
modal.style.left = leftOffset + 'px';
964-
modal.style.top = (window.innerHeight/3) + 'px';
965-
}
966-
};
967-
968957
return (
969958
<DndProvider backend={HTML5Backend}>
970959
{isLoading.isLoad ? (

microfrontends/SignDocuments/src/utils/Utils.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import axios from "axios";
2+
import { $ } from 'select-dom';
23

34
export async function getBase64FromUrl(url) {
45
const data = await fetch(url);
@@ -57,7 +58,7 @@ export function onSaveImage(xyPostion, index, signKey, imgWH, image) {
5758
(data, ind) =>
5859
data.key === signKey && data.Width && data.Height && data.SignUrl
5960
);
60-
61+
6162

6263
if (updateFilter.length > 0) {
6364
let newWidth, newHeight;
@@ -260,3 +261,14 @@ export const contactBookName = async (objectId, className) => {
260261
});
261262
return result;
262263
};
264+
265+
export const modalAlign = () => {
266+
let modalDialog = $('.modal-dialog').getBoundingClientRect();
267+
let mobileHead = $('.mobileHead').getBoundingClientRect()
268+
let modal = $('.modal-dialog');
269+
if (modalDialog.left < mobileHead.left) {
270+
let leftOffset = mobileHead.left - modalDialog.left;
271+
modal.style.left = leftOffset + 'px';
272+
modal.style.top = (window.innerHeight/3) + 'px';
273+
}
274+
};

0 commit comments

Comments
 (0)