From d18bc1c421d5cd8aa607031cb8086a86c5c08bea Mon Sep 17 00:00:00 2001 From: kara Diaby Date: Tue, 7 Apr 2020 18:20:53 +0200 Subject: [PATCH] Improve the mapbox-gl support detection for older browsers --- app/javascript/components/MapReader.js | 12 +- app/views/shared/champs/carte/_show.html.haml | 5 +- config/webpack/environment.js | 18 +- yarn.lock | 249 +++++------------- 4 files changed, 93 insertions(+), 191 deletions(-) diff --git a/app/javascript/components/MapReader.js b/app/javascript/components/MapReader.js index 3f2eaa681..aaa2380ab 100644 --- a/app/javascript/components/MapReader.js +++ b/app/javascript/components/MapReader.js @@ -1,6 +1,6 @@ import React from 'react'; import ReactMapboxGl, { ZoomControl, GeoJSONLayer } from 'react-mapbox-gl'; -import { LngLatBounds } from 'mapbox-gl'; +import mapboxgl, { LngLatBounds } from 'mapbox-gl'; import PropTypes from 'prop-types'; const Map = ReactMapboxGl({}); @@ -78,6 +78,16 @@ const MapReader = ({ geoData }) => { ]; const boundData = [swCoords, neCoords]; + if (!mapboxgl.supported()) { + return ( +

+ Nous ne pouvons pas afficher la carte car elle est imcompatible avec + votre navigateur. Nous vous conseillons de le mettre à jour ou utiliser + les dernières versions de Chrome, Firefox ou Safari +

+ ); + } + return (