aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map/GeofenceEditMap.js
diff options
context:
space:
mode:
authorDesmond Kyeremeh <elDekyfin@gmail.com>2021-07-11 22:14:39 +0000
committerDesmond Kyeremeh <elDekyfin@gmail.com>2021-07-11 22:14:39 +0000
commit1b93de84e2bf6a6532bdb03e1ae75e47061a4dca (patch)
tree8989ce8c6c5bb1d2a748ffe91895fe929c99dd5e /modern/src/map/GeofenceEditMap.js
parentefe18c504a834760242937572b369530c552e589 (diff)
downloadtrackermap-web-1b93de84e2bf6a6532bdb03e1ae75e47061a4dca.tar.gz
trackermap-web-1b93de84e2bf6a6532bdb03e1ae75e47061a4dca.tar.bz2
trackermap-web-1b93de84e2bf6a6532bdb03e1ae75e47061a4dca.zip
Fixed linting
Diffstat (limited to 'modern/src/map/GeofenceEditMap.js')
-rw-r--r--modern/src/map/GeofenceEditMap.js32
1 files changed, 16 insertions, 16 deletions
diff --git a/modern/src/map/GeofenceEditMap.js b/modern/src/map/GeofenceEditMap.js
index fe843382..f24fcb32 100644
--- a/modern/src/map/GeofenceEditMap.js
+++ b/modern/src/map/GeofenceEditMap.js
@@ -1,13 +1,13 @@
-import '@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css'
+import '@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css';
import MapboxDraw from '@mapbox/mapbox-gl-draw';
import theme from '@mapbox/mapbox-gl-draw/src/lib/theme';
import { useEffect } from 'react';
+import { useDispatch, useSelector } from 'react-redux';
+import { useHistory } from 'react-router-dom';
import { map } from './Map';
import { geofenceToFeature, geometryToArea } from './mapUtil';
-import { useDispatch, useSelector } from 'react-redux';
import { geofencesActions } from '../store';
-import { useHistory } from 'react-router-dom';
const draw = new MapboxDraw({
displayControlsDefault: false,
@@ -17,15 +17,15 @@ const draw = new MapboxDraw({
},
userProperties: true,
styles: [...theme, {
- 'id': 'gl-draw-title',
- 'type': 'symbol',
- 'filter': ['all'],
- 'layout': {
+ id: 'gl-draw-title',
+ type: 'symbol',
+ filter: ['all'],
+ layout: {
'text-field': '{user_name}',
'text-font': ['Roboto Regular'],
'text-size': 12,
},
- 'paint': {
+ paint: {
'text-halo-color': 'white',
'text-halo-width': 1,
},
@@ -36,25 +36,25 @@ const GeofenceEditMap = () => {
const dispatch = useDispatch();
const history = useHistory();
- const geofences = useSelector(state => Object.values(state.geofences.items));
+ const geofences = useSelector((state) => Object.values(state.geofences.items));
const refreshGeofences = async () => {
const response = await fetch('/api/geofences');
if (response.ok) {
dispatch(geofencesActions.refresh(await response.json()));
}
- }
+ };
useEffect(() => {
refreshGeofences();
map.addControl(draw, 'top-left');
- map.on('draw.create', async event => {
+ map.on('draw.create', async (event) => {
const feature = event.features[0];
const newItem = { name: '', area: geometryToArea(feature.geometry) };
draw.delete(feature.id);
- const response = await fetch(`/api/geofences`, {
+ const response = await fetch('/api/geofences', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(newItem),
@@ -65,7 +65,7 @@ const GeofenceEditMap = () => {
}
});
- map.on('draw.delete', async event => {
+ map.on('draw.delete', async (event) => {
const feature = event.features[0];
const response = await fetch(`/api/geofences/${feature.id}`, { method: 'DELETE' });
if (response.ok) {
@@ -73,9 +73,9 @@ const GeofenceEditMap = () => {
}
});
- map.on('draw.update', async event => {
+ map.on('draw.update', async (event) => {
const feature = event.features[0];
- const item = geofences.find(i => i.id === feature.id);
+ const item = geofences.find((i) => i.id === feature.id);
if (item) {
const updatedItem = { ...item, area: geometryToArea(feature.geometry) };
const response = await fetch(`/api/geofences/${feature.id}`, {
@@ -100,6 +100,6 @@ const GeofenceEditMap = () => {
}, [geofences]);
return null;
-}
+};
export default GeofenceEditMap;