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

Commit ec053f0

Browse files
committed
Added modal on submit job. Added nav to add another role. Updated behaviour of submit job click.
1 parent f92eb1f commit ec053f0

File tree

6 files changed

+163
-5
lines changed

6 files changed

+163
-5
lines changed
Loading

src/root.component.jsx

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import ReduxToastr from "react-redux-toastr";
1515
import store from "./store";
1616
import "./styles/main.vendor.scss";
1717
import styles from "./styles/main.module.scss";
18+
import SelectRole from "./routes/SelectRole";
1819

1920
export default function Root() {
2021
return (
@@ -33,6 +34,7 @@ export default function Root() {
3334
<TeamAccess path="/taas/myteams/:teamId/access" />
3435
<CreateNewTeam path="/taas/myteams/createnewteam" />
3536
<InputSkills path="/taas/myteams/createnewteam/:projectId/skills" />
37+
<SelectRole path="/taas/myteams/createnewteam/:projectId/role" />
3638
</Router>
3739

3840
{/* Global config for Toastr popups */}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import React from "react";
2+
import PT from "prop-types";
3+
import Modal from "react-responsive-modal";
4+
import Button from "components/Button";
5+
import IconCrossLight from "../../../../assets/images/icon-cross-light.svg";
6+
import IconSingleManAdd from "../../../../assets/images/icon-single-man-add.svg";
7+
import "./styles.module.scss";
8+
import CenteredSpinner from "components/CenteredSpinner";
9+
10+
const modalStyle = {
11+
borderRadius: "8px",
12+
padding: "32px 32px 22px 32px",
13+
maxWidth: "460px",
14+
width: "100%",
15+
margin: 0,
16+
"overflow-x": "hidden",
17+
};
18+
19+
const containerStyle = {
20+
padding: "10px",
21+
};
22+
23+
function AddAnotherModal({ open, onClose, submitDone, addAnother }) {
24+
return (
25+
<Modal
26+
open={open}
27+
center
28+
onClose={onClose}
29+
closeIcon={
30+
<IconCrossLight height="18px" width="18px" styleName="cross" />
31+
}
32+
styles={{
33+
modal: modalStyle,
34+
modalContainer: containerStyle,
35+
}}
36+
>
37+
<div styleName="modal-body">
38+
{!submitDone ? (
39+
<>
40+
<CenteredSpinner />
41+
<h5>Submitting Request...</h5>
42+
</>
43+
) : (
44+
<>
45+
<IconSingleManAdd />
46+
<h5>Add Another Position</h5>
47+
<p>You can add another position to your request if you want to.</p>
48+
</>
49+
)}
50+
</div>
51+
<div styleName="button-group">
52+
<Button
53+
type="secondary"
54+
size="medium"
55+
disabled={!submitDone}
56+
onClick={addAnother}
57+
>
58+
Add Another Position
59+
</Button>
60+
<Button type="primary" size="medium" disabled={!submitDone}>
61+
Continue
62+
</Button>
63+
</div>
64+
</Modal>
65+
);
66+
}
67+
68+
AddAnotherModal.propTypes = {
69+
open: PT.bool,
70+
onClose: PT.func,
71+
submitDone: PT.bool,
72+
addAnother: PT.func,
73+
};
74+
75+
export default AddAnotherModal;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
@import "styles/include";
2+
3+
.button-group {
4+
display: flex;
5+
flex-direction: row;
6+
justify-content: center;
7+
align-items: flex-end;
8+
:first-child {
9+
margin-right: 8px;
10+
}
11+
}
12+
13+
.modal-body {
14+
display: flex;
15+
flex-direction: column;
16+
justify-content: flex-start;
17+
align-items: center;
18+
text-align: center;
19+
margin-bottom: 80px;
20+
21+
svg {
22+
width: 48px;
23+
height: 48px;
24+
margin-bottom: 16px;
25+
}
26+
27+
h5 {
28+
@include font-barlow-condensed;
29+
font-size: 34px;
30+
color: #1e94a3;
31+
text-transform: uppercase;
32+
font-weight: 500;
33+
margin-bottom: 10px;
34+
}
35+
36+
p {
37+
@include font-roboto;
38+
font-size: 16px;
39+
color: #555555;
40+
line-height: 26px;
41+
}
42+
}
43+
44+
.cross {
45+
g {
46+
stroke: #000;
47+
}
48+
}

src/routes/InputSkills/index.jsx

+30-5
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,52 @@
11
import React, { useCallback, useEffect, useState } from "react";
2+
import { useData } from "hooks/useData";
3+
import { navigate } from "@reach/router";
4+
import { toastr } from "react-redux-toastr";
25
import SkillsList from "./components/SkillsList";
36
import Completeness from "./components/Completeness";
47
import "./styles.module.scss";
5-
import { useData } from "hooks/useData";
68
import { getSkills } from "services/skills";
79
import LoadingIndicator from "components/LoadingIndicator";
810
import SearchCard from "./components/SearchCard";
911
import ResultCard from "./components/ResultCard";
1012
import { createJob } from "services/jobs";
11-
import { navigate } from "@reach/router";
13+
import AddAnotherModal from "./components/AddAnotherModal";
1214

1315
function InputSkills({ projectId }) {
1416
const [selectedSkills, setSelectedSkills] = useState([]);
1517
const [searchState, setSearchState] = useState(null);
18+
const [modalOpen, setModalOpen] = useState(false);
19+
const [submitDone, setSubmitDone] = useState(false);
20+
1621
const [skills, loadingError] = useData(getSkills);
1722

1823
let searchTimer;
1924

2025
const submitJob = () => {
26+
setSubmitDone(false);
27+
setModalOpen(true);
2128
createJob({
2229
projectId,
2330
title: `job-${Date()}`,
2431
skills: selectedSkills,
2532
numPositions: 1,
26-
}).then(() => {
27-
navigate("/taas/myteams/createnewteam");
28-
});
33+
})
34+
.then(() => {
35+
toastr.success("Job Submitted");
36+
})
37+
.catch((err) => {
38+
console.error(err);
39+
toastr.warning("Error Submitting Job");
40+
})
41+
.finally(() => {
42+
setSubmitDone(true);
43+
});
2944
};
3045

46+
const addAnother = useCallback(() => {
47+
navigate(`/taas/myteams/createnewteam/${projectId}/role`);
48+
}, [projectId]);
49+
3150
const toggleSkill = useCallback(
3251
(id) => {
3352
if (selectedSkills.includes(id)) {
@@ -79,6 +98,12 @@ function InputSkills({ projectId }) {
7998
stage={3}
8099
onClick={submitJob}
81100
/>
101+
<AddAnotherModal
102+
open={modalOpen}
103+
onClose={() => setModalOpen(false)}
104+
submitDone={submitDone}
105+
addAnother={addAnother}
106+
/>
82107
</div>
83108
);
84109
}

src/routes/SelectRole/index.jsx

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from "react";
2+
3+
function SelectRole() {
4+
return <h2>Select A Role</h2>;
5+
}
6+
7+
export default SelectRole;

0 commit comments

Comments
 (0)