From edd952e9db7709de10d2587b08876b91fedaa5a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rio=20Nunes?= Date: Fri, 14 Jun 2024 12:25:16 +0100 Subject: [PATCH] fix: hide member mappins for precious plastic --- src/stores/Maps/filter.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/stores/Maps/filter.ts b/src/stores/Maps/filter.ts index 0b6acfd032..85663c7462 100644 --- a/src/stores/Maps/filter.ts +++ b/src/stores/Maps/filter.ts @@ -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 @@ -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) + }) }