Skip to content

Commit 9e4fd37

Browse files
committed
feat: Support direct links to the Job Candidates tabs.
resolves topcoder-archive#391
1 parent 1a3cc09 commit 9e4fd37

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

src/constants/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,20 +133,23 @@ export const CANDIDATE_STATUS_FILTERS = [
133133
title: "Candidates to Review",
134134
noCandidateMessage: "No Candidates To Review",
135135
statuses: [CANDIDATE_STATUS.OPEN],
136+
urlParam: "to-review",
136137
},
137138
{
138139
key: CANDIDATE_STATUS_FILTER_KEY.INTERESTED,
139140
buttonText: "Interviews",
140141
title: "Interviews",
141142
noCandidateMessage: "No Interviews",
142143
statuses: [CANDIDATE_STATUS.INTERVIEW],
144+
urlParam: "interviews",
143145
},
144146
{
145147
key: CANDIDATE_STATUS_FILTER_KEY.SELECTED,
146148
buttonText: "Selected",
147149
title: "Selected",
148150
noCandidateMessage: "No Selected Candidates",
149151
statuses: [CANDIDATE_STATUS.SELECTED, CANDIDATE_STATUS.OFFERED],
152+
urlParam: "selected",
150153
},
151154
{
152155
key: CANDIDATE_STATUS_FILTER_KEY.NOT_INTERESTED,
@@ -160,6 +163,7 @@ export const CANDIDATE_STATUS_FILTERS = [
160163
CANDIDATE_STATUS.TOPCODER_REJECTED,
161164
CANDIDATE_STATUS.JOB_CLOSED,
162165
],
166+
urlParam: "declined",
163167
},
164168
];
165169

src/root.component.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default function Root() {
3232
<JobForm path="/taas/myteams/:teamId/positions/new" />
3333
<ResourceBookingDetails path="/taas/myteams/:teamId/rb/:resourceBookingId" />
3434
<ResourceBookingForm path="/taas/myteams/:teamId/rb/:resourceBookingId/edit" />
35-
<PositionDetails path="/taas/myteams/:teamId/positions/:positionId/candidates" />
35+
<PositionDetails path="/taas/myteams/:teamId/positions/:positionId/candidates/*candidateStatus" />
3636
<TeamAccess path="/taas/myteams/:teamId/access" />
3737
<CreateNewTeam path="/taas/createnewteam">
3838
<CreateTeamLanding path="/" />

src/routes/PositionDetails/index.jsx

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ const inReviewStatusFilter = _.find(CANDIDATE_STATUS_FILTERS, {
2222
key: CANDIDATE_STATUS_FILTER_KEY.TO_REVIEW,
2323
});
2424

25-
const PositionDetails = ({ teamId, positionId }) => {
25+
const getKeyFromParam = (urlParam) => {
26+
const filter = _.find(CANDIDATE_STATUS_FILTERS, { urlParam });
27+
return filter?.key || undefined;
28+
}
29+
30+
const PositionDetails = ({ teamId, positionId, candidateStatus }) => {
2631
// by default show "interested" tab
2732
const [candidateStatusFilterKey, setCandidateStatusFilterKey] = useState(
2833
CANDIDATE_STATUS_FILTER_KEY.INTERESTED
@@ -41,15 +46,18 @@ const PositionDetails = ({ teamId, positionId }) => {
4146

4247
// if there are some candidates to review, then show "To Review" tab by default
4348
useEffect(() => {
44-
if (
45-
position &&
46-
_.filter(position.candidates, (candidate) =>
49+
if (position) {
50+
const key = getKeyFromParam(candidateStatus);
51+
if (key) {
52+
setCandidateStatusFilterKey(key);
53+
} else if (_.filter(position.candidates, (candidate) =>
4754
inReviewStatusFilter.statuses.includes(candidate.status)
48-
).length > 0
49-
) {
50-
setCandidateStatusFilterKey(CANDIDATE_STATUS_FILTER_KEY.TO_REVIEW);
55+
).length > 0
56+
) {
57+
setCandidateStatusFilterKey(CANDIDATE_STATUS_FILTER_KEY.TO_REVIEW);
58+
}
5159
}
52-
}, [position]);
60+
}, [position, candidateStatus]);
5361

5462
return (
5563
<Page title="Job Details">

0 commit comments

Comments
 (0)