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

Commit b210ce1

Browse files
authored
Merge pull request #413 from cagdas001/milestone-19
feat: polish release - v1.2 - Milestone19. Addresses #400, #401, #402, #404, #406, #407.
2 parents a791e9a + bb6acc2 commit b210ce1

File tree

30 files changed

+594
-328
lines changed

30 files changed

+594
-328
lines changed

src/assets/images/customer-logos.svg

+192-139
Loading

src/components/Checkbox/index.jsx

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
11
import React from "react";
22
import PT from "prop-types";
3+
import cn from "classnames";
34
import "./styles.module.scss";
45

5-
function Checkbox({ label, checked, onClick }) {
6+
function Checkbox({ label, disabled, checkmarkFloat, checked, onClick }) {
67
return (
7-
<label styleName="container">
8+
<label styleName={cn("container", { ["disabled"]: disabled })}>
89
{label}
9-
<input type="checkbox" checked={checked} onClick={onClick} />
10-
<span styleName="checkmark"></span>
10+
<input
11+
type="checkbox"
12+
checked={checked}
13+
disabled={disabled}
14+
onClick={onClick}
15+
/>
16+
<span styleName={`checkmark float-${checkmarkFloat || "left"}`}></span>
1117
</label>
1218
);
1319
}
1420

1521
Checkbox.propTypes = {
1622
label: PT.string,
23+
checkmarkFloat: PT.oneOf(["right", "left"]),
24+
disabled: PT.bool,
1725
checked: PT.bool,
1826
onClick: PT.func,
1927
};

src/components/Checkbox/styles.module.scss

+15-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
-moz-user-select: none;
1515
-ms-user-select: none;
1616
user-select: none;
17+
&.disabled {
18+
pointer-events: none;
19+
color: #a89e9e;
20+
}
1721
}
1822

1923
/* Hide the browser's default checkbox */
@@ -29,12 +33,17 @@
2933
.checkmark {
3034
position: absolute;
3135
top: 0;
32-
left: 0;
3336
height: 20px;
3437
width: 20px;
3538
background-color: #fff;
3639
border: 1px solid #AAA;
3740
border-radius: 3px;
41+
&.float-left {
42+
left: 0;
43+
}
44+
&.float-right {
45+
right: 0;
46+
}
3847
}
3948

4049
/* On mouse-over, add a grey background color */
@@ -48,6 +57,11 @@
4857
box-shadow: inset 0 1px 2px 0 rgba(0, 0, 0, 0.29);
4958
}
5059

60+
/* When the checkbox is disabled, grey out the background */
61+
.container input:disabled ~ .checkmark {
62+
background-color: #cccccc;
63+
}
64+
5165
/* Create the checkmark/indicator (hidden when not checked) */
5266
.checkmark:after {
5367
content: "";

src/components/CustomerScroll/index.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function CustomerScroll() {
55
return (
66
<div>
77
<h6 styleName="title">Trusted By</h6>
8-
<div styleName="scrolling-logos" />
8+
<div styleName="customer-logos" />
99
</div>
1010
);
1111
}

src/components/CustomerScroll/styles.module.scss

+4-34
Original file line numberDiff line numberDiff line change
@@ -10,45 +10,15 @@
1010
margin-bottom: 30px;
1111
}
1212

13-
@keyframes scroll {
14-
from {background-position: 0 0;}
15-
to {background-position: -7701px 0;}
16-
}
17-
18-
.scrolling-logos {
13+
.customer-logos {
1914
background-image: url("../../assets/images/customer-logos.svg");
20-
background-size: cover;
21-
height: 60px;
15+
background-size: contain;
16+
background-repeat: no-repeat;
17+
height: 56px;
2218
width: 100%;
23-
animation: scroll 300s linear infinite;
24-
position: relative;
25-
26-
&:before {
27-
background: linear-gradient(to right, #F4F5F6 0%, rgba(255, 255, 255, 0) 100%);
28-
content: '';
29-
height: 60px;
30-
left: 0;
31-
position: absolute;
32-
top: 0;
33-
width: 60px;
34-
z-index: 2;
35-
}
36-
&:after {
37-
background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, #F4F5F6 100%);
38-
content: '';
39-
height: 60px;
40-
position: absolute;
41-
right: 0;
42-
top: 0;
43-
width: 60px;
44-
z-index: 2;
45-
}
4619
}
4720

4821
@media only screen and (max-height: 859px) {
49-
.scrolling-logos {
50-
height: 30px;
51-
}
5222
.title {
5323
font-size: 16px;
5424
margin-bottom: 15px;

src/constants/index.js

+19
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,15 @@ export const CANDIDATES_SORT_OPTIONS = [
185185
{ label: "Handle", value: CANDIDATES_SORT_BY.HANDLE },
186186
];
187187

188+
/**
189+
* "Full or Part Time" select options
190+
*/
191+
export const FULL_OR_PART_TIME_OPTIONS = [
192+
{ label: "Full Time - 40hr/wk", value: "40" },
193+
{ label: "Part Time - 30hr/wk", value: "30" },
194+
{ label: "Part Time - 20hr/wk", value: "20" },
195+
];
196+
188197
/**
189198
* All action types
190199
*/
@@ -271,6 +280,11 @@ export const ACTION_TYPE = {
271280
ADD_MATCHING_ROLE: "ADD_MATCHING_ROLE",
272281
DELETE_MATCHING_ROLE: "DELETE_MATCHING_ROLE",
273282
EDIT_MATCHING_ROLE: "EDIT_MATCHING_ROLE",
283+
284+
/*
285+
* global loading state
286+
*/
287+
SET_IS_LOADING: "SET_IS_LOADING",
274288
};
275289

276290
/**
@@ -378,3 +392,8 @@ export const CUSTOM_ROLE_NAMES = ["custom", "niche"];
378392
* Minimal Resource Booking duration (weeks)
379393
*/
380394
export const MIN_DURATION = 4;
395+
396+
/**
397+
* Maximum allowed numbers of selecter skills for search.
398+
*/
399+
export const MAX_SELECTED_SKILLS = 3;

src/hoc/withAuthentication/index.js

+15-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
*/
1414
import React, { useEffect } from "react";
1515
import _ from "lodash";
16-
import { getAuthUserTokens, login } from "@topcoder/micro-frontends-navbar-app";
16+
import {
17+
getAuthUserTokens,
18+
login,
19+
businessLogin,
20+
} from "@topcoder/micro-frontends-navbar-app";
1721
import LoadingIndicator from "../../components/LoadingIndicator";
1822
import {
1923
authUserSuccess,
@@ -22,11 +26,12 @@ import {
2226
authLoadV5UserProfile,
2327
authClearTeamMembers,
2428
} from "./actions";
29+
import { setIsLoading } from "../../routes/CreateNewTeam/actions";
2530
import { decodeToken } from "tc-auth-lib";
2631
import { useDispatch, useSelector } from "react-redux";
2732
import { useParams } from "@reach/router";
2833

29-
export default function withAuthentication(Component) {
34+
export default function withAuthentication(Component, businessAuth = false) {
3035
const AuthenticatedComponent = (props) => {
3136
const dispatch = useDispatch();
3237
const {
@@ -49,6 +54,7 @@ export default function withAuthentication(Component) {
4954
let isUnmount = false;
5055

5156
if (!isLoggedIn) {
57+
dispatch(setIsLoading(true));
5258
getAuthUserTokens()
5359
.then(({ tokenV3 }) => {
5460
if (!!tokenV3) {
@@ -59,7 +65,7 @@ export default function withAuthentication(Component) {
5965
)
6066
);
6167
} else if (!isUnmount) {
62-
login();
68+
businessAuth ? businessLogin() : login();
6369
}
6470
})
6571
.catch((error) => dispatch(authUserError(error)));
@@ -81,6 +87,7 @@ export default function withAuthentication(Component) {
8187
params.teamId &&
8288
(!teamId || params.teamId !== teamId)
8389
) {
90+
dispatch(setIsLoading(true));
8491
dispatch(authLoadTeamMembers(params.teamId));
8592

8693
// if we are going to some page without `teamId` then we have to clear team members
@@ -96,6 +103,7 @@ export default function withAuthentication(Component) {
96103
useEffect(() => {
97104
// is user is logged-in, but V5 user profile is not loaded yet, then load it
98105
if (isLoggedIn && !v5UserProfileLoading && !v5UserProfile) {
106+
dispatch(setIsLoading(true));
99107
dispatch(authLoadV5UserProfile());
100108
}
101109
}, [dispatch, isLoggedIn, v5UserProfileLoading, v5UserProfile]);
@@ -129,3 +137,7 @@ export default function withAuthentication(Component) {
129137

130138
return AuthenticatedComponent;
131139
}
140+
141+
export function withBusinessAuthentication(Component) {
142+
return withAuthentication(Component, true);
143+
}

src/routes/CreateNewTeam/actions/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,8 @@ export const clearMatchingRole = () => (dispatch, getState) => {
7575
dispatch(deleteMatchingRole());
7676
updateLocalStorage(getState().searchedRoles);
7777
};
78+
79+
export const setIsLoading = (isLoading) => ({
80+
type: ACTION_TYPE.SET_IS_LOADING,
81+
payload: isLoading,
82+
});

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

+31-4
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ import InformationTooltip from "components/InformationTooltip";
1313
import IconCrossLight from "../../../../assets/images/icon-cross-light.svg";
1414
import "./styles.module.scss";
1515
import NumberInput from "components/NumberInput";
16+
import Select from "components/Select";
1617
import {
1718
validator,
1819
validateExists,
1920
validateMin,
2021
composeValidators,
2122
} from "./utils/validator";
22-
import { MIN_DURATION } from "constants";
23+
import { MIN_DURATION, FULL_OR_PART_TIME_OPTIONS } from "constants";
2324

2425
const Error = ({ name }) => {
2526
const {
@@ -33,7 +34,7 @@ function EditRoleForm({ onChange, role }) {
3334
const onRoleChange = (state) => {
3435
if (state.hasValidationErrors) {
3536
onChange(false);
36-
}else {
37+
} else {
3738
onChange(true, state.values);
3839
}
3940
};
@@ -61,11 +62,15 @@ function EditRoleForm({ onChange, role }) {
6162
<th># of resources</th>
6263
<th>Duration (weeks)</th>
6364
<th>Start month</th>
65+
<th>Full or Part Time</th>
6466
</tr>
6567
<tr styleName="role-row">
6668
<td>
6769
<Field
68-
validate={composeValidators(validateExists, validateMin(1, 'Should be 1 or greater'))}
70+
validate={composeValidators(
71+
validateExists,
72+
validateMin(1, "Should be 1 or greater")
73+
)}
6974
name="numberOfResources"
7075
initialValue={role.numberOfResources}
7176
>
@@ -88,7 +93,13 @@ function EditRoleForm({ onChange, role }) {
8893
</td>
8994
<td>
9095
<Field
91-
validate={composeValidators(validateExists, validateMin(MIN_DURATION, `Talent as a Service engagements have a ${MIN_DURATION} week minimum commitment.`))}
96+
validate={composeValidators(
97+
validateExists,
98+
validateMin(
99+
MIN_DURATION,
100+
`Talent as a Service engagements have a ${MIN_DURATION} week minimum commitment.`
101+
)
102+
)}
92103
name="durationWeeks"
93104
initialValue={role.durationWeeks}
94105
>
@@ -143,6 +154,22 @@ function EditRoleForm({ onChange, role }) {
143154
</div>
144155
)}
145156
</td>
157+
<td>
158+
<Field name="hoursPerWeek" initialValue={"40"}>
159+
{(props) => (
160+
<Select
161+
name={props.input.name}
162+
value={props.input.value}
163+
onChange={(v) => {
164+
props.input.onChange(v);
165+
onRoleChange(getState());
166+
}}
167+
options={FULL_OR_PART_TIME_OPTIONS}
168+
styleName="select"
169+
/>
170+
)}
171+
</Field>
172+
</td>
146173
</tr>
147174
</table>
148175
</div>

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

+8-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,14 @@
4141
margin-right: auto;
4242
}
4343

44-
padding: 18px 18px 18px 0;
44+
.select {
45+
border-radius: 4px;
46+
width: 160px;
47+
height: 34px;
48+
font-size: 14px;
49+
}
50+
51+
padding: 18px 9px;
4552
width: 30%;
4653
vertical-align: top;
4754
@include font-barlow;

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function InputContainer({
2727
<AddedRolesAccordion addedRoles={addedRoles} />
2828
<Progress
2929
isDisabled={isProgressDisabled}
30-
onClick={onClick ? onClick: search}
30+
onClick={onClick ? onClick : search}
3131
extraStyleName={progressStyle}
3232
buttonLabel="Search"
3333
stages={stages}

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

+6-2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
font-size: 14px;
4040
line-height: 16px;
4141
font-weight: 400;
42+
color: rgba(255, 255, 255, 0.6);
4243

4344
&:before {
4445
content: "";
@@ -50,23 +51,26 @@
5051
margin-right: 10px;
5152
display: block;
5253
float: left;
54+
visibility: hidden;
5355
}
5456

5557
&.active {
5658
font-weight: 500;
59+
color: #fff;
5760
&:before {
61+
visibility: visible;
5862
background-color: #fff;
5963
}
6064
}
6165

6266
&.done {
6367
font-weight: 400;
64-
color: rgba(255, 255, 255, 0.6);
6568
&:before {
6669
content: "";
6770
font-size: 9px;
6871
line-height: 14px;
69-
padding-left: 2px;
72+
padding-left: 4px;
73+
visibility: visible;
7074
}
7175
}
7276
}

0 commit comments

Comments
 (0)