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

Commit ea75ce5

Browse files
authored
Merge pull request #360 from topcoder-platform/dev
Role Intake Cool down Fix's
2 parents 130f1bd + c7b3739 commit ea75ce5

File tree

26 files changed

+402
-123
lines changed

26 files changed

+402
-123
lines changed

src/constants/index.js

+6
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,12 @@ export const ACTION_TYPE = {
258258
ADD_SEARCHED_ROLE: "ADD_SEARCHED_ROLE",
259259
ADD_ROLE_SEARCH_ID: "ADD_ROLE_SEARCH_ID",
260260
DELETE_SEARCHED_ROLE: "DELETE_SEARCHED_ROLE",
261+
262+
/*
263+
* matching role
264+
*/
265+
ADD_MATCHING_ROLE: "ADD_MATCHING_ROLE",
266+
DELETE_MATCHING_ROLE: "DELETE_MATCHING_ROLE",
261267
};
262268

263269
/**

src/routes/CreateNewTeam/actions/index.js

+19
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ const deleteRole = (id) => ({
2727
payload: id,
2828
});
2929

30+
const addMatchingRole = (matchingRole) => ({
31+
type: ACTION_TYPE.ADD_MATCHING_ROLE,
32+
payload: matchingRole,
33+
});
34+
35+
const deleteMatchingRole = () => ({
36+
type: ACTION_TYPE.DELETE_MATCHING_ROLE,
37+
});
38+
3039
export const clearSearchedRoles = () => (dispatch, getState) => {
3140
dispatch(clearRoles());
3241
updateLocalStorage(getState().searchedRoles);
@@ -46,3 +55,13 @@ export const deleteSearchedRole = (id) => (dispatch, getState) => {
4655
dispatch(deleteRole(id));
4756
updateLocalStorage(getState().searchedRoles);
4857
};
58+
59+
export const saveMatchingRole = (matchingRole) => (dispatch, getState) => {
60+
dispatch(addMatchingRole(matchingRole));
61+
updateLocalStorage(getState().searchedRoles);
62+
};
63+
64+
export const clearMatchingRole = () => (dispatch, getState) => {
65+
dispatch(deleteMatchingRole());
66+
updateLocalStorage(getState().searchedRoles);
67+
};

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

+12-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@
88
import React, { useState } from "react";
99
import PT from "prop-types";
1010
import cn from "classnames";
11+
import { useDispatch } from "react-redux";
12+
import { deleteSearchedRole } from "../../actions";
1113
import "./styles.module.scss";
14+
import IconCrossLight from "../../../../assets/images/icon-cross-light.svg";
1215

1316
function AddedRolesAccordion({ addedRoles }) {
1417
const [isOpen, setIsOpen] = useState(false);
1518

19+
const dispatch = useDispatch();
20+
1621
return addedRoles.length ? (
1722
<div styleName="accordion">
1823
<button onClick={() => setIsOpen(!isOpen)} styleName="button">
@@ -27,8 +32,13 @@ function AddedRolesAccordion({ addedRoles }) {
2732
</button>
2833
{isOpen && (
2934
<div styleName="panel">
30-
{addedRoles.map(({ name }) => (
31-
<div styleName="role-name">{name}</div>
35+
{addedRoles.map(({ name, searchId: id }) => (
36+
<div key={id} styleName="role-name">
37+
{name}
38+
<button onClick={() => dispatch(deleteSearchedRole(id))}>
39+
<IconCrossLight height="14px" width="14px" />
40+
</button>
41+
</div>
3242
))}
3343
</div>
3444
)}

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

+16-1
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,12 @@
5555
.panel {
5656
padding: 12px 18px 14px 10px;
5757
.role-name {
58-
height: 40px;
58+
position: relative;
5959
width: 100%;
6060
background-color: #F4F4F4;
6161
border-radius: 6px;
6262
padding: 10px;
63+
padding-right: 30px;
6364
@include font-barlow;
6465
font-size: 16px;
6566
line-height: 20px;
@@ -68,5 +69,19 @@
6869
&:not(:first-child) {
6970
margin-top: 5px;
7071
}
72+
73+
>button {
74+
outline: none;
75+
border: none;
76+
background: none;
77+
position: absolute;
78+
top: 12px;
79+
right: 4px;
80+
&:hover {
81+
g {
82+
stroke: red;
83+
}
84+
}
85+
}
7186
}
7287
}

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ function BaseCreateModal({
3535
loadingMessage,
3636
maxWidth = "680px",
3737
darkHeader,
38+
disableFocusTrap,
3839
children,
3940
}) {
4041
return (
@@ -51,8 +52,9 @@ function BaseCreateModal({
5152
modalContainer: containerStyle,
5253
closeButton: closeButtonStyle,
5354
}}
55+
focusTrapped={!disableFocusTrap}
5456
>
55-
<div styleName="modal-body">
57+
<div styleName="modal-body" tabIndex="-1">
5658
{isLoading ? (
5759
<div styleName={cn("modal-header", { "dark-header": darkHeader })}>
5860
<CenteredSpinner />
@@ -86,6 +88,7 @@ BaseCreateModal.propTypes = {
8688
loadingMessage: PT.string,
8789
maxWidth: PT.string,
8890
darkHeader: PT.bool,
91+
disableFocusTrap: PT.bool,
8992
children: PT.node,
9093
};
9194

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

+10-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
.completeness {
44
@include rounded-card;
5+
overflow: hidden;
56
padding: 12px;
67
position: relative;
78
width: 250px;
@@ -25,12 +26,19 @@
2526

2627
.list {
2728
margin-bottom: 55px;
29+
& + button[disabled] {
30+
background-color: #E9E9E9;
31+
color: #FFF;
32+
opacity: 1;
33+
filter: none;
34+
}
2835
}
2936

3037
.list-item {
3138
margin-bottom: 14px;
3239
font-size: 14px;
3340
line-height: 16px;
41+
font-weight: 400;
3442

3543
&:before {
3644
content: "";
@@ -45,14 +53,14 @@
4553
}
4654

4755
&.active {
48-
font-weight: 700;
56+
font-weight: 500;
4957
&:before {
5058
background-color: #fff;
5159
}
5260
}
5361

5462
&.done {
55-
font-weight: 700;
63+
font-weight: 400;
5664
color: rgba(255, 255, 255, 0.6);
5765
&:before {
5866
content: "";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/**
2+
* InputContainer
3+
*
4+
* A container component for the different
5+
* input pages. Contains logic and supporting
6+
* components for selecting for roles.
7+
*/
8+
import React from "react";
9+
import PT from "prop-types";
10+
import AddedRolesAccordion from "../AddedRolesAccordion";
11+
import Completeness from "../Completeness";
12+
import "./styles.module.scss";
13+
14+
function InputContainer({
15+
stages,
16+
isCompletenessDisabled,
17+
toRender,
18+
search,
19+
onClick,
20+
completenessStyle,
21+
addedRoles,
22+
}) {
23+
return (
24+
<div styleName="page">
25+
{toRender(search)}
26+
<div styleName="right-side">
27+
<AddedRolesAccordion addedRoles={addedRoles} />
28+
<Completeness
29+
isDisabled={isCompletenessDisabled}
30+
onClick={onClick ? onClick: search}
31+
extraStyleName={completenessStyle}
32+
buttonLabel="Search"
33+
stages={stages}
34+
percentage="26"
35+
/>
36+
</div>
37+
</div>
38+
);
39+
}
40+
41+
InputContainer.propTypes = {
42+
stages: PT.array,
43+
isCompletenessDisabled: PT.bool,
44+
search: PT.func,
45+
onClick: PT.func,
46+
toRender: PT.func,
47+
completenessStyle: PT.string,
48+
addedRoles: PT.array,
49+
};
50+
51+
export default InputContainer;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.page {
2+
display: flex;
3+
flex-direction: row;
4+
justify-content: center;
5+
align-items: flex-start;
6+
margin: 42px 35px;
7+
.right-side {
8+
display: flex;
9+
flex-direction: column;
10+
& > div:not(:first-child) {
11+
margin-top: 16px;
12+
}
13+
}
14+
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function ItemList({
3636
return (
3737
<div styleName="item-list">
3838
<PageHeader
39-
title={title}
39+
title={<div styleName="title">{title}</div>}
4040
backTo="/taas/createnewteam"
4141
aside={
4242
<>

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
height: 80vh;
1010
overflow-y: auto;
1111

12+
.title {
13+
font-weight: 500;
14+
}
1215
> header {
1316
padding: 16px 24px;
1417
}
@@ -67,4 +70,4 @@ input:not([type="checkbox"]).filter-input {
6770
justify-content: flex-start;
6871
flex-wrap: wrap;
6972
margin-right: 24px;
70-
}
73+
}

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

+45-5
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
);

0 commit comments

Comments
 (0)