Skip to content

Commit

Permalink
Update species sort (#496)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bluesmile82 authored Jul 12, 2022
1 parent fd150de commit 210aa7f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/containers/sidebars/aoi-sidebar/species-card/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,13 @@ const SpeciesCardContainer = (props) => {
}, [speciesData.species])

useEffect(() => {
const sortSpecies = (s) => orderBy(s, ['has_image', 'conservationConcern'], ['desc', 'desc']);
const sortSpecies = (s) => orderBy(s, ['has_image', 'globaldRangeArea', 'conservationConcern'], ['desc', 'desc', 'desc']);
const speciesSorted = speciesData.species && sortSpecies(
(selectedSpeciesFilter.slug === 'all') ?
[...speciesData.species] :
[...speciesData.species.filter(sp => sp.category === selectedSpeciesFilter.slug)]
);

if (speciesSorted) {
setSpeciesToDisplay(speciesSorted);
setSpeciesToDisplayBackUp([...speciesSorted]);
Expand Down

0 comments on commit 210aa7f

Please sign in to comment.