Skip to content

Commit 550ce10

Browse files
Merge pull request #318 from OpenSignLabs/modal-ui
fix: modal-ui,replace loading pdf to loading document, onclick placeholder open user details popup
2 parents 274620d + 6080c59 commit 550ce10

22 files changed

+969
-1899
lines changed

microfrontends/SignDocuments/package-lock.json

Lines changed: 0 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

microfrontends/SignDocuments/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
"react-select": "^5.8.0",
3535
"react-signature-canvas": "^1.0.6",
3636
"reactour": "^1.19.1",
37-
"select-dom": "^9.0.0",
3837
"web-vitals": "^2.1.4"
3938
},
4039
"scripts": {

microfrontends/SignDocuments/src/Component/LegaDrive/FolderDrive/legaDriveComponent.js

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ function PdfFileComponent({
2020
setDocId,
2121
setIsLoading,
2222
setPdfData,
23-
isList
23+
isList,
24+
setIsAlert
2425
}) {
2526
const [rename, setRename] = useState("");
2627
const [renameValue, setRenameValue] = useState("");
@@ -103,7 +104,10 @@ function PdfFileComponent({
103104
// console.log("res", res);
104105
})
105106
.catch((err) => {
106-
console.log("error updating field is decline ", err);
107+
setIsAlert({
108+
isShow: true,
109+
alertMessage: "something went wrong"
110+
});
107111
});
108112
}
109113
};
@@ -187,11 +191,16 @@ function PdfFileComponent({
187191
)
188192
.then((result) => {
189193
const res = result.data;
190-
const updatedData = pdfData.filter((x) => x.objectId !== docId);
191-
setPdfData(updatedData);
194+
if (res) {
195+
const updatedData = pdfData.filter((x) => x.objectId !== docId);
196+
setPdfData(updatedData);
197+
}
192198
})
193199
.catch((err) => {
194-
console.log("err", err);
200+
setIsAlert({
201+
isShow: true,
202+
alertMessage: "something went wrong"
203+
});
195204
});
196205
};
197206
const handleMoveDocument = async (docData) => {
@@ -243,10 +252,13 @@ function PdfFileComponent({
243252

244253
.then((Listdata) => {
245254
// console.log("Listdata ", Listdata);
246-
const json = Listdata.data;
247-
248-
const updatedData = pdfData.filter((x) => x.objectId !== updateDocId);
249-
setPdfData(updatedData);
255+
const res = Listdata.data;
256+
if (res) {
257+
const updatedData = pdfData.filter(
258+
(x) => x.objectId !== updateDocId
259+
);
260+
setPdfData(updatedData);
261+
}
250262
})
251263
.catch((err) => {
252264
console.log("err", err);
@@ -276,13 +288,7 @@ function PdfFileComponent({
276288

277289
//component to handle type of document and render according to type
278290
const handleFolderData = (data, ind, listType) => {
279-
let createddate,
280-
status,
281-
isDecline,
282-
signerExist,
283-
isComplete,
284-
signUrl,
285-
isPlaceholder;
291+
let createddate, status, isDecline, signerExist, isComplete, isPlaceholder;
286292
if (data.Type !== "Folder") {
287293
const expireDate = data.ExpiryDate && data.ExpiryDate.iso;
288294
const createdDate = data.createdAt && data.createdAt;
@@ -291,7 +297,7 @@ function PdfFileComponent({
291297
isDecline = data.IsDeclined && data.IsDeclined;
292298
isPlaceholder = data.Placeholders && data.Placeholders;
293299
signerExist = data.Signers && data.Signers;
294-
signUrl = data.SignedUrl && data.SignedUrl;
300+
295301
const expireUpdateDate = new Date(expireDate).getTime();
296302
const currDate = new Date().getTime();
297303
let isExpire = false;
@@ -732,11 +738,8 @@ function PdfFileComponent({
732738
onClick={() => {
733739
setIsDeleteDoc(false);
734740
}}
735-
style={{
736-
color: "black"
737-
}}
738741
type="button"
739-
className="finishBtn"
742+
className="finishBtn cancelBtn"
740743
>
741744
No
742745
</button>

microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@
116116
margin: 30px;
117117
height: 100%;
118118
}
119-
119+
.inputStyle{
120+
border: 1.6px solid #ccc !important;
121+
}
120122
.folderComponent::-webkit-scrollbar {
121123
display: none;
122124
/* for Chrome, Safari, and Opera */

microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.js

Lines changed: 99 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
import React, { useEffect, useState, useRef } from "react";
2-
import axios from "axios";
32
import "./LegaDrive.css";
43
import loader from "../../assests/loader2.gif";
54
import PdfFileComponent from "./FolderDrive/legaDriveComponent";
6-
import Modal from "react-bootstrap/Modal";
7-
import ModalHeader from "react-bootstrap/esm/ModalHeader";
85
import { themeColor, iconColor } from "../../utils/ThemeColor/backColor";
96
import { getDrive } from "../../utils/Utils";
10-
import AlertComponent from "../component/alertComponent";
117
import { useNavigate } from "react-router-dom";
128
import Title from "../component/Title";
139
import Parse from "parse";
@@ -57,32 +53,38 @@ function PdfFile() {
5753
isLoad: true,
5854
message: "This might take some time"
5955
};
60-
56+
let driveDetails;
6157
setIsLoading(load);
62-
63-
const driveDetails = await getDrive();
64-
if (driveDetails) {
65-
if (driveDetails.length > 0) {
66-
setPdfData(driveDetails);
67-
sortApps(null, null, driveDetails);
68-
}
69-
const data = [
70-
{
71-
name: "OpenSign™ Drive",
72-
objectId: ""
58+
try {
59+
driveDetails = await getDrive();
60+
if (driveDetails) {
61+
if (driveDetails.length > 0) {
62+
setPdfData(driveDetails);
63+
sortApps(null, null, driveDetails);
7364
}
74-
];
75-
setFolderName(data);
76-
const loadObj = {
77-
isLoad: false
78-
};
79-
setIsLoading(loadObj);
80-
} else if (driveDetails === "Error: Something went wrong!") {
81-
const loadObj = {
82-
isLoad: false
83-
};
84-
setHandleError("Error: Something went wrong!");
85-
setIsLoading(loadObj);
65+
const data = [
66+
{
67+
name: "OpenSign™ Drive",
68+
objectId: ""
69+
}
70+
];
71+
setFolderName(data);
72+
const loadObj = {
73+
isLoad: false
74+
};
75+
setIsLoading(loadObj);
76+
} else if (driveDetails === "Error: Something went wrong!") {
77+
const loadObj = {
78+
isLoad: false
79+
};
80+
setHandleError("Error: Something went wrong!");
81+
setIsLoading(loadObj);
82+
}
83+
} catch (e) {
84+
setIsAlert({
85+
isShow: true,
86+
alertMessage: "something went wrong"
87+
});
8688
}
8789
};
8890
//function for get parent folder document list
@@ -92,24 +94,33 @@ function PdfFile() {
9294
message: "This might take some time"
9395
};
9496
setIsLoading(load);
95-
const driveDetails = await getDrive(docId);
96-
if (driveDetails) {
97-
if (driveDetails.length > 0) {
98-
setPdfData(driveDetails);
99-
sortApps(null, null, driveDetails);
100-
} else {
101-
setPdfData([]);
97+
let driveDetails;
98+
try {
99+
driveDetails = await getDrive(docId);
100+
101+
if (driveDetails) {
102+
if (driveDetails.length > 0) {
103+
setPdfData(driveDetails);
104+
sortApps(null, null, driveDetails);
105+
} else {
106+
setPdfData([]);
107+
}
108+
const loadObj = {
109+
isLoad: false
110+
};
111+
setIsLoading(loadObj);
112+
} else if (driveDetails === "Error: Something went wrong!") {
113+
const loadObj = {
114+
isLoad: false
115+
};
116+
setHandleError("Error: Something went wrong!");
117+
setIsLoading(loadObj);
102118
}
103-
const loadObj = {
104-
isLoad: false
105-
};
106-
setIsLoading(loadObj);
107-
} else if (driveDetails === "Error: Something went wrong!") {
108-
const loadObj = {
109-
isLoad: false
110-
};
111-
setHandleError("Error: Something went wrong!");
112-
setIsLoading(loadObj);
119+
} catch (e) {
120+
setIsAlert({
121+
isShow: true,
122+
alertMessage: "something went wrong!"
123+
});
113124
}
114125
};
115126

@@ -187,7 +198,7 @@ function PdfFile() {
187198
} catch (e) {
188199
setIsAlert({
189200
isShow: true,
190-
alertMessage: "something went wrong"
201+
alertMessage: "something went wrong!"
191202
});
192203
}
193204
} else {
@@ -328,11 +339,43 @@ function PdfFile() {
328339
<div className="folderComponent ">
329340
<Title title={"OpenSign™ Drive"} drive={true} />
330341
<div>
331-
<AlertComponent
332-
isShow={isAlert.isShow}
333-
alertMessage={isAlert.alertMessage}
334-
setIsAlert={setIsAlert}
335-
/>
342+
<ModalUi
343+
headerColor={"#dc3545"}
344+
isOpen={isAlert.isShow}
345+
title={"Alert"}
346+
handleClose={() => {
347+
setIsAlert({
348+
isShow: false,
349+
alertMessage: ""
350+
});
351+
}}
352+
>
353+
<div style={{ height: "100%", padding: 20 }}>
354+
<p>{isAlert.alertMessage}</p>
355+
356+
<div
357+
style={{
358+
height: "1px",
359+
backgroundColor: "#9f9f9f",
360+
width: "100%",
361+
marginTop: "15px",
362+
marginBottom: "15px"
363+
}}
364+
></div>
365+
<button
366+
onClick={() =>
367+
setIsAlert({
368+
isShow: false,
369+
alertMessage: ""
370+
})
371+
}
372+
type="button"
373+
className="finishBtn cancelBtn"
374+
>
375+
Close
376+
</button>
377+
</div>
378+
</ModalUi>
336379
<ModalUi
337380
isOpen={isFolder}
338381
title={"Add New Folder"}
@@ -373,12 +416,13 @@ function PdfFile() {
373416
fontWeight: "400"
374417
}}
375418
>
376-
Name*
419+
Name
420+
<span style={{ color: "red" }}>*</span>
377421
</label>
378422

379423
<input
380424
required
381-
className="form-control"
425+
className="form-control inputStyle"
382426
type="text"
383427
value={newFolderName}
384428
onChange={(e) => handleFolderName(e)}
@@ -409,11 +453,8 @@ function PdfFile() {
409453
Add
410454
</button>
411455
<button
412-
style={{
413-
color: "black"
414-
}}
415456
type="button"
416-
className="finishBtn"
457+
className="finishBtn cancelBtn"
417458
onClick={oncloseFolder}
418459
>
419460
Close
@@ -704,6 +745,7 @@ function PdfFile() {
704745
isDocId={docId}
705746
setPdfData={setPdfData}
706747
isList={isList}
748+
setIsAlert={setIsAlert}
707749
/>
708750
)}
709751
</>

0 commit comments

Comments
 (0)