Skip to content

Commit

Permalink
fix: hide member mappins for precious plastic (#3661)
Browse files Browse the repository at this point in the history
  • Loading branch information
mariojsnunes committed Jun 14, 2024
2 parents 0573975 + edd952e commit 3d1e3b8
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/stores/Maps/filter.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { isPreciousPlastic } from 'src/config/config'

import type { IMapPin } from 'src/models/maps.models'

// filter pins to include matched pin type or subtype
Expand All @@ -14,10 +16,16 @@ export const filterMapPinsByType = (
filterList.delete('verified')
}

const filterFn =
filterList.size === 0
? (p) => !p._deleted
: (p) => !p._deleted && filterList.has(p.subType || p.type)
return filteredPins.filter((pin) => {
if (filterList.size === 0) {
// no filter => remove deleted and hide members if precious-plastic
if (isPreciousPlastic()) {
return !pin._deleted && pin.type !== 'member'
}

return !pin._deleted
}

return filteredPins.filter(filterFn)
return !pin._deleted && filterList.has(pin.subType || pin.type)
})
}

0 comments on commit 3d1e3b8

Please sign in to comment.