fix new prettier defaults
This commit is contained in:
parent
02b15e10cf
commit
43a1ead1cb
40 changed files with 111 additions and 122 deletions
|
@ -2,7 +2,7 @@ import Chartkick from 'chartkick';
|
|||
import Highcharts from 'highcharts';
|
||||
import { toggle, delegate } from '@utils';
|
||||
|
||||
export default function() {
|
||||
export default function () {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,6 @@ import Loadable from 'react-loadable';
|
|||
|
||||
const loading = () => <div className="spinner left" />;
|
||||
|
||||
export default function(loader) {
|
||||
export default function (loader) {
|
||||
return Loadable({ loader, loading });
|
||||
}
|
||||
|
|
|
@ -11,12 +11,12 @@ import '@reach/combobox/styles.css';
|
|||
import PropTypes from 'prop-types';
|
||||
|
||||
let cache = {};
|
||||
const useAddressSearch = searchTerm => {
|
||||
const useAddressSearch = (searchTerm) => {
|
||||
const [addresses, setAddresses] = useState([]);
|
||||
useEffect(() => {
|
||||
if (searchTerm.trim() !== '') {
|
||||
let isFresh = true;
|
||||
fetchAddresses(searchTerm).then(addresses => {
|
||||
fetchAddresses(searchTerm).then((addresses) => {
|
||||
if (isFresh) setAddresses(addresses);
|
||||
});
|
||||
return () => (isFresh = false);
|
||||
|
@ -25,12 +25,12 @@ const useAddressSearch = searchTerm => {
|
|||
return addresses;
|
||||
};
|
||||
|
||||
const fetchAddresses = value => {
|
||||
const fetchAddresses = (value) => {
|
||||
if (cache[value]) {
|
||||
return Promise.resolve(cache[value]);
|
||||
}
|
||||
const url = `https://api-adresse.data.gouv.fr/search/`;
|
||||
return getJSON(url, { q: value, limit: 5 }, 'get').then(result => {
|
||||
return getJSON(url, { q: value, limit: 5 }, 'get').then((result) => {
|
||||
if (result) {
|
||||
cache[value] = result;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ const fetchAddresses = value => {
|
|||
const SearchInput = ({ getCoords }) => {
|
||||
const [searchTerm, setSearchTerm] = useState('');
|
||||
const addresses = useAddressSearch(searchTerm);
|
||||
const handleSearchTermChange = event => {
|
||||
const handleSearchTermChange = (event) => {
|
||||
setSearchTerm(event.target.value);
|
||||
};
|
||||
return (
|
||||
|
@ -72,7 +72,7 @@ const SearchInput = ({ getCoords }) => {
|
|||
>
|
||||
{addresses.features.length > 0 ? (
|
||||
<ComboboxList>
|
||||
{addresses.features.map(feature => {
|
||||
{addresses.features.map((feature) => {
|
||||
const str = `${feature.properties.name}, ${feature.properties.city}`;
|
||||
return (
|
||||
<ComboboxOption
|
||||
|
|
|
@ -18,7 +18,7 @@ function filterFeatureCollection(featureCollection, source) {
|
|||
return {
|
||||
type: 'FeatureCollection',
|
||||
features: featureCollection.features.filter(
|
||||
feature => feature.properties.source === source
|
||||
(feature) => feature.properties.source === source
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ const MapEditor = ({ featureCollection, url }) => {
|
|||
updateFeaturesList(features);
|
||||
}
|
||||
|
||||
const onMapLoad = map => {
|
||||
const onMapLoad = (map) => {
|
||||
setCurrentMap(map);
|
||||
|
||||
drawControl.current.draw.set(
|
||||
|
@ -83,7 +83,7 @@ const MapEditor = ({ featureCollection, url }) => {
|
|||
);
|
||||
};
|
||||
|
||||
const onCadastresUpdate = evt => {
|
||||
const onCadastresUpdate = (evt) => {
|
||||
if (currentMap) {
|
||||
currentMap
|
||||
.getSource('cadastres-layer')
|
||||
|
@ -93,10 +93,10 @@ const MapEditor = ({ featureCollection, url }) => {
|
|||
}
|
||||
};
|
||||
|
||||
const onGpxImport = e => {
|
||||
const onGpxImport = (e) => {
|
||||
let reader = new FileReader();
|
||||
reader.readAsText(e.target.files[0], 'UTF-8');
|
||||
reader.onload = async event => {
|
||||
reader.onload = async (event) => {
|
||||
const featureCollection = gpx(
|
||||
new DOMParser().parseFromString(event.target.result, 'text/xml')
|
||||
);
|
||||
|
@ -149,14 +149,14 @@ const MapEditor = ({ featureCollection, url }) => {
|
|||
}}
|
||||
>
|
||||
<SearchInput
|
||||
getCoords={searchTerm => {
|
||||
getCoords={(searchTerm) => {
|
||||
setCoords(searchTerm);
|
||||
setZoom([17]);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<Map
|
||||
onStyleLoad={map => onMapLoad(map)}
|
||||
onStyleLoad={(map) => onMapLoad(map)}
|
||||
fitBounds={bbox}
|
||||
fitBoundsOptions={{ padding: 100 }}
|
||||
center={coords}
|
||||
|
|
|
@ -72,7 +72,7 @@ function onFileChange(handler, directUploadUrl) {
|
|||
|
||||
function uploadFile(input, file, directUploadUrl) {
|
||||
const controller = new Uploader(input, file, directUploadUrl);
|
||||
return controller.start().then(signedId => {
|
||||
return controller.start().then((signedId) => {
|
||||
input.value = null;
|
||||
return signedId;
|
||||
});
|
||||
|
|
|
@ -17,7 +17,9 @@ function TypeDeChampRepetitionOptions({
|
|||
return (
|
||||
<div className="repetition flex-grow cell">
|
||||
<SortableContainer
|
||||
onSortEnd={params => dispatch({ type: 'onSortTypeDeChamps', params })}
|
||||
onSortEnd={(params) =>
|
||||
dispatch({ type: 'onSortTypeDeChamps', params })
|
||||
}
|
||||
useDragHandle
|
||||
>
|
||||
{state.typeDeChamps.map((typeDeChamp, index) => (
|
||||
|
|
|
@ -12,12 +12,14 @@ function TypeDeChamps({ state: rootState, typeDeChamps }) {
|
|||
typeDeChamps
|
||||
});
|
||||
|
||||
const hasUnsavedChamps = state.typeDeChamps.some(tdc => tdc.id == undefined);
|
||||
const hasUnsavedChamps = state.typeDeChamps.some(
|
||||
(tdc) => tdc.id == undefined
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="champs-editor">
|
||||
<SortableContainer
|
||||
onSortEnd={params => dispatch({ type: 'onSortTypeDeChamps', params })}
|
||||
onSortEnd={(params) => dispatch({ type: 'onSortTypeDeChamps', params })}
|
||||
lockAxis="y"
|
||||
useDragHandle
|
||||
>
|
||||
|
|
|
@ -5,7 +5,7 @@ export function createTypeDeChampOperation(typeDeChamp, queue) {
|
|||
method: 'post',
|
||||
payload: { type_de_champ: typeDeChamp }
|
||||
})
|
||||
.then(data => {
|
||||
.then((data) => {
|
||||
handleResponseData(typeDeChamp, data);
|
||||
});
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ export function updateTypeDeChampOperation(typeDeChamp, queue) {
|
|||
method: 'patch',
|
||||
payload: { type_de_champ: typeDeChamp }
|
||||
})
|
||||
.then(data => {
|
||||
.then((data) => {
|
||||
handleResponseData(typeDeChamp, data);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ function addTypeDeChamp(state, typeDeChamps, insertAfter, done) {
|
|||
});
|
||||
}
|
||||
})
|
||||
.catch(message => state.flash.error(message));
|
||||
.catch((message) => state.flash.error(message));
|
||||
|
||||
let newTypeDeChamps = [...typeDeChamps, typeDeChamp];
|
||||
if (insertAfter) {
|
||||
|
@ -127,7 +127,7 @@ function updateTypeDeChamp(
|
|||
function removeTypeDeChamp(state, typeDeChamps, { typeDeChamp }) {
|
||||
destroyTypeDeChampOperation(typeDeChamp, state.queue)
|
||||
.then(() => state.flash.success())
|
||||
.catch(message => state.flash.error(message));
|
||||
.catch((message) => state.flash.error(message));
|
||||
|
||||
return {
|
||||
...state,
|
||||
|
@ -141,7 +141,7 @@ function moveTypeDeChampUp(state, typeDeChamps, { typeDeChamp }) {
|
|||
|
||||
moveTypeDeChampOperation(typeDeChamp, newIndex, state.queue)
|
||||
.then(() => state.flash.success())
|
||||
.catch(message => state.flash.error(message));
|
||||
.catch((message) => state.flash.error(message));
|
||||
|
||||
return {
|
||||
...state,
|
||||
|
@ -155,7 +155,7 @@ function moveTypeDeChampDown(state, typeDeChamps, { typeDeChamp }) {
|
|||
|
||||
moveTypeDeChampOperation(typeDeChamp, newIndex, state.queue)
|
||||
.then(() => state.flash.success())
|
||||
.catch(message => state.flash.error(message));
|
||||
.catch((message) => state.flash.error(message));
|
||||
|
||||
return {
|
||||
...state,
|
||||
|
@ -166,7 +166,7 @@ function moveTypeDeChampDown(state, typeDeChamps, { typeDeChamp }) {
|
|||
function onSortTypeDeChamps(state, typeDeChamps, { oldIndex, newIndex }) {
|
||||
moveTypeDeChampOperation(typeDeChamps[oldIndex], newIndex, state.queue)
|
||||
.then(() => state.flash.success())
|
||||
.catch(message => state.flash.error(message));
|
||||
.catch((message) => state.flash.error(message));
|
||||
|
||||
return {
|
||||
...state,
|
||||
|
@ -191,13 +191,13 @@ function getUpdateHandler(typeDeChamp, { queue, flash }) {
|
|||
let handler = updateHandlers.get(typeDeChamp);
|
||||
if (!handler) {
|
||||
handler = debounce(
|
||||
done =>
|
||||
(done) =>
|
||||
updateTypeDeChampOperation(typeDeChamp, queue)
|
||||
.then(() => {
|
||||
flash.success();
|
||||
done();
|
||||
})
|
||||
.catch(message => flash.error(message)),
|
||||
.catch((message) => flash.error(message)),
|
||||
200
|
||||
);
|
||||
updateHandlers.set(typeDeChamp, handler);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue