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

Commit b47476b

Browse files
committed
Allow user to add custom role to added roles list from No Matching Profiles card.
1 parent a01c56b commit b47476b

File tree

4 files changed

+69
-11
lines changed

4 files changed

+69
-11
lines changed

src/routes/CreateNewTeam/actions/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const addMatchingRole = (matchingRole) => ({
3232
payload: matchingRole,
3333
});
3434

35-
const deleteMatchingRole = (matchingRole) => ({
35+
const deleteMatchingRole = () => ({
3636
type: ACTION_TYPE.DELETE_MATCHING_ROLE,
3737
});
3838

@@ -61,7 +61,7 @@ export const saveMatchingRole = (matchingRole) => (dispatch, getState) => {
6161
updateLocalStorage(getState().searchedRoles);
6262
};
6363

64-
export const clearMatchingRole = (matchingRole) => (dispatch, getState) => {
64+
export const clearMatchingRole = () => (dispatch, getState) => {
6565
dispatch(deleteMatchingRole());
6666
updateLocalStorage(getState().searchedRoles);
6767
};

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

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,42 @@
22
* No Matching Profiles Result Card
33
* Card that appears when there are no matching profiles after searching.
44
*/
5-
import React from "react";
5+
import React, { useCallback, useMemo } from "react";
66
import { Link } from "@reach/router";
77
import PT from "prop-types";
8+
import { useDispatch, useSelector } from "react-redux";
9+
import { addSearchedRole } from "../../actions";
810
import "./styles.module.scss";
911
import IconEarthX from "../../../../assets/images/icon-earth-x.svg";
1012
import Curve from "../../../../assets/images/curve.svg";
1113
import Button from "components/Button";
1214
import { formatMoney } from "utils/format";
1315

1416
function NoMatchingProfilesResultCard({ role }) {
17+
const { addedRoles } = useSelector((state) => state.searchedRoles);
18+
19+
const alreadyAdded = useMemo(() => {
20+
if (
21+
addedRoles.find(
22+
(addedRole) => addedRole.searchId === role.roleSearchRequestId
23+
)
24+
) {
25+
return true;
26+
}
27+
return false;
28+
}, [addedRoles, role]);
29+
30+
const dispatch = useDispatch();
31+
32+
const addRole = useCallback(() => {
33+
const searchId = role.roleSearchRequestId;
34+
let name = "Custom Role";
35+
if (role.jobTitle && role.jobTitle.length) {
36+
name = role.jobTitle;
37+
}
38+
dispatch(addSearchedRole({ searchId, name }));
39+
}, [dispatch, role]);
40+
1541
return (
1642
<div styleName="result-card">
1743
<div styleName="heading">
@@ -21,6 +47,11 @@ function NoMatchingProfilesResultCard({ role }) {
2147
<IconEarthX styleName="transparent-icon" />
2248
</div>
2349
<div styleName="content">
50+
<h4 styleName="job-title">
51+
{role.jobTitle && role.jobTitle.length
52+
? role.jobTitle
53+
: "Custom Role"}
54+
</h4>
2455
<p styleName="info-txt">
2556
We will be looking internally for members matching your requirements
2657
and be back at them in about 2 weeks.
@@ -38,11 +69,20 @@ function NoMatchingProfilesResultCard({ role }) {
3869
<p>/Week</p>
3970
</div>
4071
)}
41-
<Link to="/taas/createnewteam">
42-
<Button type="secondary" styleName="button">
43-
Modify Search Criteria
72+
<div styleName="button-group">
73+
<Link to="/taas/createnewteam">
74+
<Button styleName="left" type="secondary">
75+
Modify Search Criteria
76+
</Button>
77+
</Link>
78+
<Button
79+
onClick={addRole}
80+
disabled={!role.roleSearchRequestId || alreadyAdded}
81+
type="primary"
82+
>
83+
{alreadyAdded ? "Added" : "Add Custom Role"}
4484
</Button>
45-
</Link>
85+
</div>
4686
</div>
4787
</div>
4888
);

src/routes/CreateNewTeam/components/NoMatchingProfilesResultCard/styles.module.scss

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
justify-content: flex-start;
1414
align-items: center;
1515
padding: 30px 0 60px 0;
16-
margin-bottom: 30px;
16+
margin-bottom: 14px;
1717
color: #fff;
1818
background-image: linear-gradient(225deg, #555555 0%, #2A2A2A 100%);
1919
position: relative;
@@ -41,6 +41,17 @@
4141
flex-direction: column;
4242
align-items: center;
4343
padding-bottom: 61px;
44+
.job-title {
45+
@include font-barlow;
46+
font-size: 22px;
47+
margin-bottom: 18px;
48+
font-weight: 600;
49+
text-align: center;
50+
text-transform: uppercase;
51+
// position text over bottom of header image
52+
position: relative;
53+
z-index: 100;
54+
}
4455
p.info-txt {
4556
@include font-roboto;
4657
font-size: 14px;
@@ -82,8 +93,15 @@
8293
}
8394
}
8495

85-
.button {
96+
.button-group {
8697
margin-top: 62px;
98+
display: flex;
99+
flex-direction: row;
100+
align-items: center;
101+
102+
.left {
103+
margin-right: 30px;
104+
}
87105
}
88106
}
89107

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import "./styles.module.scss";
2626
import { isCustomRole, setCurrentStage } from "utils/helpers";
2727
import { clearSearchedRoles } from "../../actions";
2828
import { postTeamRequest } from "services/teams";
29-
import SuccessCard from "../SuccessCard";
29+
import NoMatchingProfilesResultCard from "../NoMatchingProfilesResultCard";
3030

3131
function SubmitContainer({
3232
stages,
@@ -112,7 +112,7 @@ function SubmitContainer({
112112
{!isCustomRole(matchingRole) ? (
113113
<ResultCard role={matchingRole} />
114114
) : (
115-
<SuccessCard />
115+
<NoMatchingProfilesResultCard role={matchingRole} />
116116
)}
117117
<div styleName="right-side">
118118
<AddedRolesAccordion addedRoles={addedRoles} />

0 commit comments

Comments
 (0)