@@ -22,7 +22,12 @@ const inReviewStatusFilter = _.find(CANDIDATE_STATUS_FILTERS, {
22
22
key : CANDIDATE_STATUS_FILTER_KEY . TO_REVIEW ,
23
23
} ) ;
24
24
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 } ) => {
26
31
// by default show "interested" tab
27
32
const [ candidateStatusFilterKey , setCandidateStatusFilterKey ] = useState (
28
33
CANDIDATE_STATUS_FILTER_KEY . INTERESTED
@@ -41,15 +46,18 @@ const PositionDetails = ({ teamId, positionId }) => {
41
46
42
47
// if there are some candidates to review, then show "To Review" tab by default
43
48
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 ) =>
47
54
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
+ }
51
59
}
52
- } , [ position ] ) ;
60
+ } , [ position , candidateStatus ] ) ;
53
61
54
62
return (
55
63
< Page title = "Job Details" >
0 commit comments