From 7dd22a534547b3ca9ae3622e10338653a5d2ec0c Mon Sep 17 00:00:00 2001 From: vcoppe Date: Sat, 13 Jul 2024 12:19:59 +0200 Subject: [PATCH] message when webgl2 is not supported --- website/src/lib/components/Map.svelte | 18 ++++++++++++++++-- website/src/locales/en.json | 4 +++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/website/src/lib/components/Map.svelte b/website/src/lib/components/Map.svelte index cf146cfa..a4c4e6f0 100644 --- a/website/src/lib/components/Map.svelte +++ b/website/src/lib/components/Map.svelte @@ -7,9 +7,10 @@ import MapboxGeocoder from '@mapbox/mapbox-gl-geocoder'; import '@mapbox/mapbox-gl-geocoder/dist/mapbox-gl-geocoder.css'; + import { Button } from '$lib/components/ui/button'; import { map } from '$lib/stores'; import { settings } from '$lib/db'; - import { locale } from 'svelte-i18n'; + import { locale, _ } from 'svelte-i18n'; import { get } from 'svelte/store'; import { PUBLIC_MAPBOX_TOKEN } from '$env/static/public'; @@ -33,6 +34,10 @@ }); onMount(() => { + if (!mapboxgl.supported()) { + return; + } + let newMap = new mapboxgl.Map({ container: 'map', style: { version: 8, sources: {}, layers: [] }, @@ -140,7 +145,16 @@
-
+ {#if mapboxgl.supported()} +
+ {:else} +
+

{$_('webgl2_required')}

+ +
+ {/if}