Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 03127a5

Browse files
author
Arpit Chaudhari
authored
Merge branch 'dev' into dev
2 parents 7f95bd2 + ec92e6a commit 03127a5

File tree

4 files changed

+134
-15
lines changed

4 files changed

+134
-15
lines changed

src/routes/CreateNewTeam/components/SearchAndSubmit/index.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@ function SearchAndSubmit(props) {
2929

3030
const matchedSkills = useMemo(() => {
3131
if (skills && matchingRole && matchingRole.matchedSkills) {
32-
return _.map(matchingRole.matchedSkills, (s) =>
32+
return _.compact(_.map(matchingRole.matchedSkills, (s) =>
3333
_.find(skills, (skill) => skill.name === s)
34-
);
34+
));
3535
} else {
3636
return [];
3737
}
3838
}, [skills, matchingRole]);
3939

4040
const unMatchedSkills = useMemo(() => {
4141
if (skills && matchingRole && matchingRole.unMatchedSkills) {
42-
return _.map(matchingRole.unMatchedSkills, (s) =>
42+
return _.compact(_.map(matchingRole.unMatchedSkills, (s) =>
4343
_.find(skills, (skill) => skill.name === s)
44-
);
44+
));
4545
} else {
4646
return [];
4747
}

src/routes/CreateNewTeam/pages/CreateTaasPayment/PaymentForm/index.jsx

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
useElements,
99
} from "@stripe/react-stripe-js";
1010
import { navigate } from "@reach/router";
11+
import _ from "lodash";
1112
import { toastr } from "react-redux-toastr";
1213
import { makeStyles } from "@material-ui/core/styles";
1314
import Typography from "@material-ui/core/Typography";
@@ -19,6 +20,7 @@ import StripeElement from "../StripeElement";
1920
import FormField from "../FormField";
2021
import SelectField from "../SelectField";
2122
import ConfirmationModal from "../../../components/ConfirmationModal";
23+
import PaymentResultPopup from "../PaymentResultPopup";
2224

2325
import "./styles.module.scss";
2426

@@ -50,13 +52,15 @@ const PaymentForm = ({ calculatedAmount }) => {
5052
const [formValues, setFormValues] = useState(initialFormValues);
5153
const [dropdownValue, setDropdownValue] = useState("");
5254
const [processing, setProcessing] = useState(false);
55+
const [showPaymentResultPopup, setShowPaymentResultPopup] = useState(false);
5356
const [requestLoading, setRequestLoading] = useState(false);
5457
const [errors, setErrors] = useState({
5558
card: true,
5659
cardExpire: true,
5760
cardCvc: true,
5861
});
5962
const [clicked, setClicked] = useState(true);
63+
const [projectId, setProjectId] = useState(null);
6064
const stripe = useStripe();
6165
const elements = useElements();
6266
const dispatch = useDispatch();
@@ -105,6 +109,11 @@ const PaymentForm = ({ calculatedAmount }) => {
105109
[name]: value,
106110
});
107111
};
112+
const goToTassProject = () => {
113+
dispatch(clearSearchedRoles());
114+
setShowPaymentResultPopup(false);
115+
navigate(`/taas/myteams/${projectId}`);
116+
};
108117
const handleFormSubmit = async (e) => {
109118
e.preventDefault();
110119
if (formIsValid() && clicked) {
@@ -132,14 +141,11 @@ const PaymentForm = ({ calculatedAmount }) => {
132141
toastr.error("Payment failed", payload.error.message);
133142
} else if (payload.paymentIntent.status === "succeeded") {
134143
toastr.success("Payment is successful");
135-
setRequestLoading(true);
144+
// setRequestLoading(true);
136145
postTeamRequest(teamObject)
137-
.then(() => {
138-
setTimeout(() => {
139-
dispatch(clearSearchedRoles());
140-
// Backend api create project has sync issue, so delay 2 seconds
141-
navigate("/taas/myteams");
142-
}, 2000);
146+
.then((res) => {
147+
setProjectId(_.get(res, "data.projectId"));
148+
setShowPaymentResultPopup(true);
143149
})
144150
.catch((err) => {
145151
setRequestLoading(false);
@@ -233,10 +239,14 @@ const PaymentForm = ({ calculatedAmount }) => {
233239
{processing ? "Payment Processing" : `Pay $${calculatedAmount}`}
234240
</button>
235241
</form>
236-
<ConfirmationModal
237-
open={requestLoading}
238-
isLoading={requestLoading}
239-
loadingMessage="Creating A New Team"
242+
243+
<ConfirmationModal open={requestLoading} isLoading={requestLoading} loadingMessage="Creating A New Team"/>
244+
<PaymentResultPopup
245+
open={showPaymentResultPopup}
246+
onContinueClick={goToTassProject}
247+
onClose={() => {
248+
setShowPaymentResultPopup(false);
249+
}}
240250
/>
241251
</>
242252
);
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/**
2+
* Payment result popup
3+
*/
4+
import React, { useState, useEffect } from "react";
5+
import PT from "prop-types";
6+
import { useInterval } from "react-use";
7+
import Button from "components/Button";
8+
import BaseCreateModal from "../../../components/BaseCreateModal";
9+
import "./styles.module.scss";
10+
11+
function PaymentResultPopup({ open, onClose, onContinueClick }) {
12+
const [second, setSecond] = useState(10);
13+
useInterval(
14+
() => {
15+
setSecond(second - 1);
16+
},
17+
second > 0 ? 1000 : null
18+
);
19+
useEffect(() => {
20+
if (second === 0) {
21+
onContinueClick();
22+
}
23+
}, [second, onContinueClick]);
24+
25+
const Buttons = (
26+
<div styleName="button-contaier">
27+
<Button
28+
type="primary"
29+
size="medium"
30+
styleName="continue-button"
31+
onClick={onContinueClick}
32+
>
33+
TAKE ME TO MY TEAM
34+
</Button>
35+
<div styleName="time-label">
36+
You will be automatically redirected in{" "}
37+
{second === 0 || second === 10 ? second : "0" + second} seconds
38+
</div>
39+
</div>
40+
);
41+
42+
return (
43+
<BaseCreateModal
44+
open={open}
45+
onClose={onClose}
46+
maxWidth="560px"
47+
buttons={Buttons}
48+
>
49+
<h1 styleName="header">WE'VE RECEIVED YOUR DEPOSIT</h1>
50+
<div styleName="sub-header">
51+
Thanks for trusting us with your talent needs! You will be redirected to
52+
your Team page where you can review candidates, schedule interviews, and
53+
lock in your selections.
54+
</div>
55+
</BaseCreateModal>
56+
);
57+
}
58+
59+
PaymentResultPopup.propTypes = {
60+
open: PT.bool,
61+
onClose: PT.func,
62+
onContinueClick: PT.func,
63+
};
64+
65+
export default PaymentResultPopup;
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
@import "styles/include";
2+
3+
.header {
4+
margin-top: -30px;
5+
background-color: #ffffff;
6+
background-image: linear-gradient(
7+
90deg
8+
, #9D41C9, #EF476F);
9+
background-size: 100%;
10+
background-clip: text;
11+
-webkit-text-fill-color: transparent;
12+
font-family: BarlowCondensed;
13+
font-size: 34px;
14+
line-height: 38px;
15+
text-align: center;
16+
}
17+
18+
.sub-header {
19+
@include font-roboto;
20+
margin-top: 20px;
21+
color: #2A2A2A;
22+
font-size: 16px;
23+
line-height: 26px;
24+
text-align: center;
25+
}
26+
27+
.button-contaier {
28+
display: flex;
29+
flex-direction: column;
30+
align-items: center;
31+
32+
.time-label {
33+
@include font-roboto;
34+
margin-top: 10px;
35+
color: #2A2A2A;
36+
font-size: 14px;
37+
line-height: 22px;
38+
text-align: center;
39+
}
40+
}
41+
42+
.continue-button:disabled {
43+
background-color: #997b7be6;
44+
}

0 commit comments

Comments
 (0)