Skip to content

Commit e0ff9c6

Browse files
committed
- Updated CreateNewTeam page so selecting role does not create a team
Bug fixes: - topcoder-archive#293 - topcoder-archive#292
1 parent 89afba3 commit e0ff9c6

File tree

5 files changed

+37
-25
lines changed

5 files changed

+37
-25
lines changed

src/root.component.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default function Root() {
3636
<TeamAccess path="/taas/myteams/:teamId/access" />
3737
<InputJobDescription path="/taas/myteams/createnewteam/jd" />
3838
<InputSkills path="/taas/myteams/createnewteam/:projectId/skills" />
39-
<SelectRole path="/taas/myteams/createnewteam/:projectId/role" />
39+
<SelectRole path="/taas/myteams/createnewteam/role" />
4040
</Router>
4141

4242
{/* Global config for Toastr popups */}

src/routes/CreateNewTeam/index.jsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import LandingBox from "./components/LandingBox";
1414
import IconMultipleActionsCheck from "../../assets/images/icon-multiple-actions-check-2.svg";
1515
import IconListQuill from "../../assets/images/icon-list-quill.svg";
1616
import IconOfficeFileText from "../../assets/images/icon-office-file-text.svg";
17-
import { postProject } from "services/teams";
18-
import withAuthentication from "../../hoc/withAuthentication";
1917

2018
function CreateNewTeam() {
2119
const createProjectAndNavigate = async (navigateTo) => {
@@ -30,6 +28,10 @@ function CreateNewTeam() {
3028
});
3129
};
3230

31+
const goToSelectRole = () => {
32+
navigate("/taas/myteams/createnewteam/role");
33+
};
34+
3335
const goToJobDescription = () => {
3436
navigate(`/taas/myteams/createnewteam/jd`);
3537
};
@@ -45,7 +47,7 @@ function CreateNewTeam() {
4547
description="You know you want a front end developer, or a full stack developer, mobile one or others."
4648
icon={<IconMultipleActionsCheck />}
4749
backgroundImage="linear-gradient(101.95deg, #8B41B0 0%, #EF476F 100%)"
48-
onClick={() => createProjectAndNavigate("role")}
50+
onClick={goToSelectRole}
4951
/>
5052
<LandingBox
5153
title="Input Skills"
@@ -65,4 +67,4 @@ function CreateNewTeam() {
6567
);
6668
}
6769

68-
export default withAuthentication(CreateNewTeam);
70+
export default CreateNewTeam;

src/routes/CreateNewTeam/pages/SelectRole/components/RoleItem/styles.module.scss

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
border: 1px solid #d4d4d4;
55
border-radius: 5px;
66
padding: 12px 16px;
7-
width: 213px;
7+
width: 212px;
88
height: 136px;
99
display: flex;
1010
flex-direction: column;
1111
justify-content: space-evenly;
12-
margin: 0 0 24px 24px;
12+
align-items: flex-start;
13+
margin: 0 0 23px 23px;
1314
cursor: pointer;
1415

1516
&.selected {
@@ -22,6 +23,7 @@
2223
width: 42px;
2324
height: 42px;
2425
margin-left: 8px;
26+
object-fit: cover;
2527
}
2628

2729
.item-text {
@@ -38,7 +40,7 @@
3840
padding: 0;
3941
outline: none;
4042
background: none;
41-
color: #0D61BF;
43+
color: #0d61bf;
4244
border: none;
4345
text-align: left;
4446

src/routes/CreateNewTeam/pages/SelectRole/components/RolesList/styles.module.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
max-width: 746px;
66
margin-right: 20px;
77
position: relative;
8+
height: 80vh;
9+
overflow-y: scroll;
810

911
> header {
1012
padding: 16px 24px;

src/routes/CreateNewTeam/pages/SelectRole/index.jsx

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import React, { useCallback, useEffect, useState } from "react";
1010
import { useData } from "hooks/useData";
1111
import { navigate } from "@reach/router";
1212
import { toastr } from "react-redux-toastr";
13-
import PT from "prop-types";
1413
import RolesList from "./components/RolesList";
1514
import Completeness from "../../components/Completeness";
1615
import "./styles.module.scss";
@@ -25,8 +24,10 @@ import AddAnotherModal from "../../components/AddAnotherModal";
2524
import RoleDetailsModal from "../../components/RoleDetailsModal";
2625
import withAuthentication from "../../../../hoc/withAuthentication";
2726
import AddedRolesAccordion from "./components/AddedRolesAccordion";
27+
import { postProject } from "services/teams";
28+
import _ from "lodash";
2829

29-
function SelectRole({ projectId }) {
30+
function SelectRole() {
3031
const [stages, setStages] = useState([
3132
{ name: "Select a Role", isCurrent: true },
3233
{ name: "Search Member" },
@@ -47,19 +48,28 @@ function SelectRole({ projectId }) {
4748

4849
const submitJob = () => {
4950
setSubmitDone(false);
50-
createJob({
51-
projectId,
52-
title: `job-${Date()}`,
53-
skills: [],
54-
roleIds: addedRoles.map((r) => r.id),
55-
numPositions: 1,
56-
})
57-
.then(() => {
58-
toastr.success("Job Submitted");
51+
postProject()
52+
.then((res) => {
53+
const projectId = _.get(res, "data.id");
54+
55+
createJob({
56+
projectId,
57+
title: `job-${Date()}`,
58+
skills: [],
59+
roleIds: addedRoles.map((r) => r.id),
60+
numPositions: 1,
61+
})
62+
.then(() => {
63+
toastr.success("Job Submitted");
64+
})
65+
.catch((err) => {
66+
console.error(err);
67+
toastr.warning("Error Submitting Job");
68+
});
5969
})
6070
.catch((err) => {
6171
console.error(err);
62-
toastr.warning("Error Submitting Job");
72+
toastr.warning("Error Creating Project");
6373
})
6474
.finally(() => {
6575
setSubmitDone(true);
@@ -184,8 +194,4 @@ function SelectRole({ projectId }) {
184194
}
185195
}
186196

187-
SelectRole.propTypes = {
188-
projectId: PT.string,
189-
};
190-
191-
export default withAuthentication(SelectRole);
197+
export default SelectRole;

0 commit comments

Comments
 (0)