Skip to content

Commit 428bb3b

Browse files
fix: design of sent mail message,change variable name emailCount to emailList
1 parent ac0cdd2 commit 428bb3b

File tree

4 files changed

+43
-42
lines changed

4 files changed

+43
-42
lines changed

microfrontends/SignDocuments/src/Component/component/emailComponent.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ function EmailComponent({
2020
pdfName,
2121
sender
2222
}) {
23-
const [emailCount, setEmailCount] = useState([]);
23+
const [emailList, setEmailList] = useState([]);
2424
const [emailValue, setEmailValue] = useState();
2525
const [isLoading, setIsLoading] = useState(false);
2626
//function for send email
2727
const sendEmail = async () => {
2828
setIsLoading(true);
2929
let sendMail;
30-
for (let i = 0; i < emailCount.length; i++) {
30+
for (let i = 0; i < emailList.length; i++) {
3131
try {
3232
const imgPng =
3333
"https://qikinnovation.ams3.digitaloceanspaces.com/logo.png";
@@ -44,7 +44,7 @@ function EmailComponent({
4444
let params = {
4545
pdfName: pdfName,
4646
url: pdfUrl,
47-
recipient: emailCount[i],
47+
recipient: emailList[i],
4848
subject: `${sender.name} has signed the doc - ${pdfName}`,
4949
from: sender.email,
5050
html:
@@ -69,7 +69,7 @@ function EmailComponent({
6969
if (sendMail.data.result.status === "success") {
7070
setIsEmail(false);
7171
setEmailValue("");
72-
setEmailCount("");
72+
setEmailList([]);
7373
setSuccessEmail(true);
7474
setTimeout(() => {
7575
setSuccessEmail(false);
@@ -87,8 +87,8 @@ function EmailComponent({
8787

8888
//function for remove email
8989
const removeChip = (index) => {
90-
const updateEmailCount = emailCount.filter((data, key) => key !== index);
91-
setEmailCount(updateEmailCount);
90+
const updateEmailCount = emailList.filter((data, key) => key !== index);
91+
setEmailList(updateEmailCount);
9292
};
9393
//function for get email value
9494
const handleEmailValue = (e) => {
@@ -99,10 +99,10 @@ function EmailComponent({
9999
//function for save email in array after press enter
100100
const handleEnterPress = (e) => {
101101
if (e.key === "Enter" && emailValue) {
102-
setEmailCount((prev) => [...prev, emailValue]);
102+
setEmailList((prev) => [...prev, emailValue]);
103103
setEmailValue("");
104104
} else if (e === "add" && emailValue) {
105-
setEmailCount((prev) => [...prev, emailValue]);
105+
setEmailList((prev) => [...prev, emailValue]);
106106
setEmailValue("");
107107
}
108108
};
@@ -253,7 +253,7 @@ function EmailComponent({
253253
>
254254
Recipients added here will get a copy of the signed document.
255255
</p>
256-
{emailCount.length > 0 ? (
256+
{emailList.length > 0 ? (
257257
<>
258258
<div className="addEmail">
259259
<div
@@ -264,7 +264,7 @@ function EmailComponent({
264264
flexWrap: "wrap"
265265
}}
266266
>
267-
{emailCount.map((data, ind) => {
267+
{emailList.map((data, ind) => {
268268
return (
269269
<div
270270
className="emailChip"
@@ -297,7 +297,7 @@ function EmailComponent({
297297
);
298298
})}
299299
</div>
300-
{emailCount.length <= 9 && (
300+
{emailList.length <= 9 && (
301301
<input
302302
type="text"
303303
value={emailValue}
@@ -370,19 +370,19 @@ function EmailComponent({
370370
onClick={() => {
371371
setIsEmail(false);
372372
setEmailValue("");
373-
setEmailCount("");
373+
setEmailList([]);
374374
}}
375375
>
376376
Close
377377
</button>
378378
<button
379-
disabled={emailCount.length === 0 && true}
379+
disabled={emailList.length === 0 && true}
380380
style={{
381381
background: themeColor(),
382382
color: "white"
383383
}}
384384
type="button"
385-
className={emailCount.length === 0 ? "defaultBtn" : "finishBtn"}
385+
className={emailList.length === 0 ? "defaultBtn" : "finishBtn"}
386386
onClick={() => sendEmail()}
387387
>
388388
Send
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from "react";
2+
import "../../css/signature.css";
3+
4+
function EmailToast({ isShow }) {
5+
return (
6+
<div
7+
style={{ display: isShow ? "flex" : "none", justifyContent: "center" }}
8+
>
9+
<div className="emailToast">
10+
<span style={{ fontSize: "12px", fontWeight: "500" }}>
11+
Email sent successfully!
12+
</span>
13+
</div>
14+
</div>
15+
);
16+
}
17+
18+
export default EmailToast;

microfrontends/SignDocuments/src/Component/component/renderPdf.js

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Toast from "react-bootstrap/Toast";
44
import { Rnd } from "react-rnd";
55
import { themeColor } from "../../utils/ThemeColor/backColor";
66
import { Document, Page, pdfjs } from "react-pdf";
7+
import EmailToast from "./emailToast";
78

89
pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`;
910

@@ -274,20 +275,7 @@ function RenderPdf({
274275
ref={drop}
275276
id="container"
276277
>
277-
<div className="d-flex justify-content-center">
278-
<Toast
279-
show={successEmail}
280-
delay={3000}
281-
autohide
282-
className="d-inline-block m-1"
283-
bg="success"
284-
style={{ background: "#348545" }}
285-
>
286-
<Toast.Body className={"text-white"}>
287-
Email sent successful!
288-
</Toast.Body>
289-
</Toast>
290-
</div>
278+
<EmailToast isShow={successEmail} />
291279
{pdfLoadFail.status &&
292280
(recipient
293281
? !pdfUrl &&
@@ -825,20 +813,7 @@ function RenderPdf({
825813
ref={drop}
826814
id="container"
827815
>
828-
<div className="d-flex justify-content-center">
829-
<Toast
830-
show={successEmail}
831-
delay={3000}
832-
autohide
833-
className="d-inline-block m-1"
834-
bg="success"
835-
style={{ background: "#348545" }}
836-
>
837-
<Toast.Body className={"text-white"}>
838-
Email sent successful!
839-
</Toast.Body>
840-
</Toast>
841-
</div>
816+
<EmailToast isShow={successEmail} />
842817
{pdfLoadFail.status &&
843818
(recipient
844819
? !pdfUrl &&

microfrontends/SignDocuments/src/css/signature.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818
.mailBtn:hover {
1919
box-shadow: 0 2px 4px rgba(154, 36, 36, 0.1), 0 2px 4px rgba(0, 0, 0, 0.18);
2020
}
21+
.emailToast{
22+
position: absolute;
23+
z-index: 10;
24+
background: #aeedae;
25+
padding: 0 3px 3px 3px;
26+
margin: 2px;
27+
border-radius: 2px;
28+
}
2129
.signatureBtn {
2230
border: 1.5px solid #47a3ad;
2331
margin-bottom: 10px;

0 commit comments

Comments
 (0)