Compare commits

...

2 Commits

Author SHA1 Message Date
Mees Frensel 3644f67f59 use single query param 2026-03-05 11:02:02 +01:00
Mees Frensel 372aad07d5 fix(web): gracefully handle map errors when WebGL is disabled 2026-02-26 17:53:38 +01:00
3 changed files with 130 additions and 101 deletions
+2
View File
@@ -1050,6 +1050,7 @@
"cant_get_number_of_comments": "Can't get number of comments", "cant_get_number_of_comments": "Can't get number of comments",
"cant_search_people": "Can't search people", "cant_search_people": "Can't search people",
"cant_search_places": "Can't search places", "cant_search_places": "Can't search places",
"enable_webgl_for_map": "Enable WebGL to load the map.{isAdmin, select, true { To hide this warning, disable the map feature.} other {}}",
"error_adding_assets_to_album": "Error adding assets to album", "error_adding_assets_to_album": "Error adding assets to album",
"error_adding_users_to_album": "Error adding users to album", "error_adding_users_to_album": "Error adding users to album",
"error_deleting_shared_user": "Error deleting shared user", "error_deleting_shared_user": "Error deleting shared user",
@@ -1245,6 +1246,7 @@
"go_back": "Go back", "go_back": "Go back",
"go_to_folder": "Go to folder", "go_to_folder": "Go to folder",
"go_to_search": "Go to search", "go_to_search": "Go to search",
"go_to_settings": "Go to settings",
"gps": "GPS", "gps": "GPS",
"gps_missing": "No GPS", "gps_missing": "No GPS",
"grant_permission": "Grant permission", "grant_permission": "Grant permission",
@@ -11,15 +11,17 @@
<script lang="ts"> <script lang="ts">
import { afterNavigate } from '$app/navigation'; import { afterNavigate } from '$app/navigation';
import OnEvents from '$lib/components/OnEvents.svelte'; import OnEvents from '$lib/components/OnEvents.svelte';
import { Theme } from '$lib/constants'; import { OpenQueryParam, Theme } from '$lib/constants';
import { serverConfigManager } from '$lib/managers/server-config-manager.svelte'; import { serverConfigManager } from '$lib/managers/server-config-manager.svelte';
import { themeManager } from '$lib/managers/theme-manager.svelte'; import { themeManager } from '$lib/managers/theme-manager.svelte';
import MapSettingsModal from '$lib/modals/MapSettingsModal.svelte'; import MapSettingsModal from '$lib/modals/MapSettingsModal.svelte';
import { Route } from '$lib/route';
import { mapSettings } from '$lib/stores/preferences.store'; import { mapSettings } from '$lib/stores/preferences.store';
import { user } from '$lib/stores/user.store';
import { getAssetMediaUrl, handlePromiseError } from '$lib/utils'; import { getAssetMediaUrl, handlePromiseError } from '$lib/utils';
import { getMapMarkers, type MapMarkerResponseDto } from '@immich/sdk'; import { getMapMarkers, type MapMarkerResponseDto } from '@immich/sdk';
import { Icon, modalManager } from '@immich/ui'; import { Icon, Link, modalManager, Text } from '@immich/ui';
import { mdiCog, mdiMap, mdiMapMarker } from '@mdi/js'; import { mdiCog, mdiInformationOutline, mdiMap, mdiMapMarker } from '@mdi/js';
import type { Feature, GeoJsonProperties, Geometry, Point } from 'geojson'; import type { Feature, GeoJsonProperties, Geometry, Point } from 'geojson';
import { isEqual, omit } from 'lodash-es'; import { isEqual, omit } from 'lodash-es';
import { DateTime, Duration } from 'luxon'; import { DateTime, Duration } from 'luxon';
@@ -301,8 +303,10 @@
<OnEvents {onAssetsDelete} /> <OnEvents {onAssetsDelete} />
<!-- We handle style loading ourselves so we set style blank here --> <!-- Use svelte:boundary instead of MapLibre onerror until https://github.com/dimfeld/svelte-maplibre/issues/279 is fixed -->
<MapLibre <svelte:boundary>
<!-- We handle style loading ourselves so we set style blank here -->
<MapLibre
{hash} {hash}
style="" style=""
class="h-full {rounded ? 'rounded-2xl' : 'rounded-none'}" class="h-full {rounded ? 'rounded-2xl' : 'rounded-none'}"
@@ -320,7 +324,7 @@
} }
}} }}
bind:map bind:map
> >
{#snippet children({ map }: { map: Map })} {#snippet children({ map }: { map: Map })}
{#if showSimpleControls} {#if showSimpleControls}
<NavigationControl position="top-left" showCompass={!simplified} /> <NavigationControl position="top-left" showCompass={!simplified} />
@@ -406,4 +410,26 @@
</MarkerLayer> </MarkerLayer>
</GeoJSON> </GeoJSON>
{/snippet} {/snippet}
</MapLibre> </MapLibre>
{#snippet failed(_)}
<div
class={[
'flex place-content-center place-items-center text-warning',
simplified ? 'gap-4 px-6 text-sm' : 'h-full mx-auto gap-6',
]}
>
<div>
<Icon icon={mdiInformationOutline} size={simplified ? '18' : '24'} />
</div>
<div>
<Text>
{$t('errors.enable_webgl_for_map', { values: { isAdmin: $user.isAdmin } })}
</Text>
{#if $user.isAdmin}
<Link href={Route.systemSettings({ isOpen: OpenQueryParam.LOCATION })}>{$t('go_to_settings')}</Link>
{/if}
</div>
</div>
{/snippet}
</svelte:boundary>
+1
View File
@@ -65,6 +65,7 @@ export enum OpenQueryParam {
OAUTH = 'oauth', OAUTH = 'oauth',
JOB = 'job', JOB = 'job',
STORAGE_TEMPLATE = 'storage-template', STORAGE_TEMPLATE = 'storage-template',
LOCATION = 'location',
NOTIFICATIONS = 'notifications', NOTIFICATIONS = 'notifications',
PURCHASE_SETTINGS = 'user-purchase-settings', PURCHASE_SETTINGS = 'user-purchase-settings',
} }