File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
src/shared/containers/Gigs Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,9 @@ const sortByOptions = [
21
21
{ label : 'Latest Updated Descending' , selected : false } ,
22
22
] ;
23
23
// Locations
24
- let locations = [ ] ;
24
+ let locations = [ {
25
+ label : 'All' , selected : true ,
26
+ } ] ;
25
27
26
28
class RecruitCRMJobsContainer extends React . Component {
27
29
constructor ( props ) {
@@ -123,12 +125,15 @@ class RecruitCRMJobsContainer extends React.Component {
123
125
jobsToDisplay = _ . filter ( jobs , ( job ) => {
124
126
const country = job . country === 'Anywhere' || job . country === 'Any' ? 'All' : job . country ;
125
127
// build dropdown
126
- const found = _ . find ( locations , { label : country } ) ;
127
- if ( ! found ) {
128
+ const found = _ . findIndex ( locations , { label : country } ) ;
129
+ if ( found === - 1 ) {
128
130
locations . push ( {
129
131
label : country , selected : location . toLowerCase ( ) === country . toLowerCase ( ) ,
130
132
} ) ;
133
+ } else {
134
+ locations [ found ] . selected = location . toLowerCase ( ) === country . toLowerCase ( ) ;
131
135
}
136
+ locations [ 0 ] . selected = location === 'All' ;
132
137
// filter
133
138
if ( location === 'Anywhere' || location === 'Any' || location === 'All' ) return true ;
134
139
return location . toLowerCase ( ) === job . country . toLowerCase ( ) ;
You can’t perform that action at this time.
0 commit comments