fix(eslint): fix eslint warnings
This commit is contained in:
parent
1e46e437bb
commit
5d63ced246
6 changed files with 30 additions and 44 deletions
|
@ -44,13 +44,8 @@ function MapEditor({ featureCollection, url, options, preview }) {
|
||||||
enabled: !preview,
|
enabled: !preview,
|
||||||
cadastreEnabled
|
cadastreEnabled
|
||||||
});
|
});
|
||||||
const {
|
const { style, layers, setStyle, setLayerEnabled, setLayerOpacity } =
|
||||||
style,
|
useMapStyle(options.layers, {
|
||||||
layers,
|
|
||||||
setStyle,
|
|
||||||
setLayerEnabled,
|
|
||||||
setLayerOpacity
|
|
||||||
} = useMapStyle(options.layers, {
|
|
||||||
onStyleChange,
|
onStyleChange,
|
||||||
cadastreEnabled
|
cadastreEnabled
|
||||||
});
|
});
|
||||||
|
|
|
@ -133,20 +133,15 @@ export function useMapboxEditor(
|
||||||
);
|
);
|
||||||
|
|
||||||
const addEventListeners = useCallback((events) => {
|
const addEventListeners = useCallback((events) => {
|
||||||
const unsubscribe = Object.entries(
|
const unsubscribe = Object.entries(events).map(
|
||||||
events
|
([eventName, [target, callback]]) =>
|
||||||
).map(([eventName, [target, callback]]) =>
|
|
||||||
addEventListener(eventName, target, callback)
|
addEventListener(eventName, target, callback)
|
||||||
);
|
);
|
||||||
return () => unsubscribe.map((unsubscribe) => unsubscribe());
|
return () => unsubscribe.map((unsubscribe) => unsubscribe());
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const {
|
const { createFeatures, updateFeatures, deleteFeatures, ...props } =
|
||||||
createFeatures,
|
useFeatureCollection(featureCollection, {
|
||||||
updateFeatures,
|
|
||||||
deleteFeatures,
|
|
||||||
...props
|
|
||||||
} = useFeatureCollection(featureCollection, {
|
|
||||||
url,
|
url,
|
||||||
enabled: isSupported && enabled,
|
enabled: isSupported && enabled,
|
||||||
addFeatures,
|
addFeatures,
|
||||||
|
|
|
@ -13,20 +13,10 @@ import { useMapbox } from './useMapbox';
|
||||||
const Mapbox = ReactMapboxGl({});
|
const Mapbox = ReactMapboxGl({});
|
||||||
|
|
||||||
const MapReader = ({ featureCollection, options }) => {
|
const MapReader = ({ featureCollection, options }) => {
|
||||||
const {
|
const { isSupported, onLoad, onStyleChange, onMouseEnter, onMouseLeave } =
|
||||||
isSupported,
|
useMapbox(featureCollection);
|
||||||
onLoad,
|
const { style, layers, setStyle, setLayerEnabled, setLayerOpacity } =
|
||||||
onStyleChange,
|
useMapStyle(options.layers, { onStyleChange });
|
||||||
onMouseEnter,
|
|
||||||
onMouseLeave
|
|
||||||
} = useMapbox(featureCollection);
|
|
||||||
const {
|
|
||||||
style,
|
|
||||||
layers,
|
|
||||||
setStyle,
|
|
||||||
setLayerEnabled,
|
|
||||||
setLayerOpacity
|
|
||||||
} = useMapStyle(options.layers, { onStyleChange });
|
|
||||||
|
|
||||||
if (!isSupported) {
|
if (!isSupported) {
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { createPortal } from 'react-dom';
|
import { createPortal } from 'react-dom';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
export function FlashMessage({ message, level, sticky, fixed }) {
|
export function FlashMessage({ message, level, sticky, fixed }) {
|
||||||
return createPortal(
|
return createPortal(
|
||||||
|
@ -22,3 +23,10 @@ function flashClassName(level, sticky = false, fixed = false) {
|
||||||
}
|
}
|
||||||
return className.join(' ');
|
return className.join(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FlashMessage.propTypes = {
|
||||||
|
message: PropTypes.string,
|
||||||
|
level: PropTypes.string,
|
||||||
|
sticky: PropTypes.bool,
|
||||||
|
fixed: PropTypes.bool
|
||||||
|
};
|
||||||
|
|
|
@ -198,8 +198,7 @@ export default {
|
||||||
sources: {
|
sources: {
|
||||||
'decoupage-administratif': {
|
'decoupage-administratif': {
|
||||||
type: 'vector',
|
type: 'vector',
|
||||||
url:
|
url: 'https://openmaptiles.geo.data.gouv.fr/data/decoupage-administratif.json'
|
||||||
'https://openmaptiles.geo.data.gouv.fr/data/decoupage-administratif.json'
|
|
||||||
},
|
},
|
||||||
openmaptiles: {
|
openmaptiles: {
|
||||||
type: 'vector',
|
type: 'vector',
|
||||||
|
|
|
@ -99,9 +99,8 @@ export default class AutoUploadController {
|
||||||
}
|
}
|
||||||
|
|
||||||
_hideErrorMessage() {
|
_hideErrorMessage() {
|
||||||
let errorElement = this.input.parentElement.querySelector(
|
let errorElement =
|
||||||
'.attachment-error'
|
this.input.parentElement.querySelector('.attachment-error');
|
||||||
);
|
|
||||||
if (errorElement) {
|
if (errorElement) {
|
||||||
hide(errorElement);
|
hide(errorElement);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue