diff --git a/src/common/attributes/useGeofenceAttributes.js b/src/common/attributes/useGeofenceAttributes.js index a5cd068b88..de4d31c51a 100644 --- a/src/common/attributes/useGeofenceAttributes.js +++ b/src/common/attributes/useGeofenceAttributes.js @@ -15,4 +15,8 @@ export default (t) => useMemo(() => ({ type: 'number', subtype: 'distance', }, + hide: { + name: t('sharedFilterMap'), + type: 'boolean', + }, }), [t]); diff --git a/src/map/MapGeofence.js b/src/map/MapGeofence.js index 73b32724d2..2c294ab911 100644 --- a/src/map/MapGeofence.js +++ b/src/map/MapGeofence.js @@ -83,7 +83,9 @@ const MapGeofence = () => { if (mapGeofences) { map.getSource(id)?.setData({ type: 'FeatureCollection', - features: Object.values(geofences).map((geofence) => geofenceToFeature(theme, geofence)), + features: Object.values(geofences) + .filter((geofence) => !geofence.attributes.hide) + .map((geofence) => geofenceToFeature(theme, geofence)), }); } }, [mapGeofences, geofences]); diff --git a/src/settings/GeofencePage.jsx b/src/settings/GeofencePage.jsx index c3c96ef8cd..60a29828b1 100644 --- a/src/settings/GeofencePage.jsx +++ b/src/settings/GeofencePage.jsx @@ -1,7 +1,13 @@ import React, { useState } from 'react'; import { useDispatch } from 'react-redux'; import { - Accordion, AccordionSummary, AccordionDetails, Typography, TextField, + Accordion, + AccordionSummary, + AccordionDetails, + Typography, + TextField, + FormControlLabel, + Checkbox, } from '@mui/material'; import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import EditItemView from './components/EditItemView'; @@ -72,6 +78,10 @@ const GeofencePage = () => { endpoint="/api/calendars" label={t('sharedCalendar')} /> + setItem({ ...item, attributes: { ...item.attributes, hide: e.target.checked }})} />} + label={t('sharedFilterMap')} + />