mirror of
https://github.com/immich-app/immich.git
synced 2026-07-23 13:54:05 +03:00
Compare commits
2 Commits
fix/auto-h
...
fix/map-we
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3644f67f59 | ||
|
|
372aad07d5 |
@@ -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,109 +303,133 @@
|
|||||||
|
|
||||||
<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>
|
||||||
{hash}
|
<!-- We handle style loading ourselves so we set style blank here -->
|
||||||
style=""
|
<MapLibre
|
||||||
class="h-full {rounded ? 'rounded-2xl' : 'rounded-none'}"
|
{hash}
|
||||||
{zoom}
|
style=""
|
||||||
{center}
|
class="h-full {rounded ? 'rounded-2xl' : 'rounded-none'}"
|
||||||
bounds={initialBounds}
|
{zoom}
|
||||||
fitBoundsOptions={{ padding: 50, maxZoom: 15 }}
|
{center}
|
||||||
attributionControl={false}
|
bounds={initialBounds}
|
||||||
diffStyleUpdates={true}
|
fitBoundsOptions={{ padding: 50, maxZoom: 15 }}
|
||||||
onload={(event: Map) => {
|
attributionControl={false}
|
||||||
event.setMaxZoom(18);
|
diffStyleUpdates={true}
|
||||||
event.on('click', handleMapClick);
|
onload={(event: Map) => {
|
||||||
if (!simplified) {
|
event.setMaxZoom(18);
|
||||||
event.addControl(new GlobeControl(), 'top-left');
|
event.on('click', handleMapClick);
|
||||||
}
|
if (!simplified) {
|
||||||
}}
|
event.addControl(new GlobeControl(), 'top-left');
|
||||||
bind:map
|
}
|
||||||
>
|
}}
|
||||||
{#snippet children({ map }: { map: Map })}
|
bind:map
|
||||||
{#if showSimpleControls}
|
>
|
||||||
<NavigationControl position="top-left" showCompass={!simplified} />
|
{#snippet children({ map }: { map: Map })}
|
||||||
|
{#if showSimpleControls}
|
||||||
|
<NavigationControl position="top-left" showCompass={!simplified} />
|
||||||
|
|
||||||
{#if !simplified}
|
{#if !simplified}
|
||||||
<GeolocateControl position="top-left" />
|
<GeolocateControl position="top-left" />
|
||||||
<FullscreenControl position="top-left" />
|
<FullscreenControl position="top-left" />
|
||||||
<ScaleControl />
|
<ScaleControl />
|
||||||
<AttributionControl compact={false} />
|
<AttributionControl compact={false} />
|
||||||
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if showSettings}
|
{#if showSettings}
|
||||||
<Control>
|
<Control>
|
||||||
<ControlGroup>
|
<ControlGroup>
|
||||||
<ControlButton onclick={handleSettingsClick}>
|
<ControlButton onclick={handleSettingsClick}>
|
||||||
<Icon icon={mdiCog} size="100%" class="text-black/80" />
|
<Icon icon={mdiCog} size="100%" class="text-black/80" />
|
||||||
</ControlButton>
|
</ControlButton>
|
||||||
</ControlGroup>
|
</ControlGroup>
|
||||||
</Control>
|
</Control>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if onOpenInMapView && showSimpleControls}
|
{#if onOpenInMapView && showSimpleControls}
|
||||||
<Control position="top-right">
|
<Control position="top-right">
|
||||||
<ControlGroup>
|
<ControlGroup>
|
||||||
<ControlButton onclick={() => onOpenInMapView()}>
|
<ControlButton onclick={() => onOpenInMapView()}>
|
||||||
<Icon title={$t('open_in_map_view')} icon={mdiMap} size="100%" class="text-black/80" />
|
<Icon title={$t('open_in_map_view')} icon={mdiMap} size="100%" class="text-black/80" />
|
||||||
</ControlButton>
|
</ControlButton>
|
||||||
</ControlGroup>
|
</ControlGroup>
|
||||||
</Control>
|
</Control>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<GeoJSON
|
<GeoJSON
|
||||||
data={{
|
data={{
|
||||||
type: 'FeatureCollection',
|
type: 'FeatureCollection',
|
||||||
features: mapMarkers?.map((marker) => asFeature(marker)) ?? [],
|
features: mapMarkers?.map((marker) => asFeature(marker)) ?? [],
|
||||||
}}
|
|
||||||
id="geojson"
|
|
||||||
cluster={{ radius: 35, maxZoom: 18 }}
|
|
||||||
>
|
|
||||||
<MarkerLayer
|
|
||||||
applyToClusters
|
|
||||||
asButton
|
|
||||||
onclick={(event) => handlePromiseError(handleClusterClick(event.feature.properties?.cluster_id, map))}
|
|
||||||
>
|
|
||||||
{#snippet children({ feature })}
|
|
||||||
<div
|
|
||||||
class="rounded-full w-10 h-10 bg-immich-primary text-white flex justify-center items-center font-mono font-bold shadow-lg hover:bg-immich-dark-primary transition-all duration-200 hover:text-immich-dark-bg opacity-90"
|
|
||||||
>
|
|
||||||
{feature.properties?.point_count?.toLocaleString()}
|
|
||||||
</div>
|
|
||||||
{/snippet}
|
|
||||||
</MarkerLayer>
|
|
||||||
<MarkerLayer
|
|
||||||
applyToClusters={false}
|
|
||||||
asButton
|
|
||||||
onclick={(event) => {
|
|
||||||
if (!popup) {
|
|
||||||
handleAssetClick(event.feature.properties?.id, map);
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
|
id="geojson"
|
||||||
|
cluster={{ radius: 35, maxZoom: 18 }}
|
||||||
>
|
>
|
||||||
{#snippet children({ feature }: { feature: Feature })}
|
<MarkerLayer
|
||||||
{#if useLocationPin}
|
applyToClusters
|
||||||
<Icon icon={mdiMapMarker} size="50px" class="text-primary -translate-y-[50%]" />
|
asButton
|
||||||
{:else}
|
onclick={(event) => handlePromiseError(handleClusterClick(event.feature.properties?.cluster_id, map))}
|
||||||
<img
|
>
|
||||||
src={getAssetMediaUrl({ id: feature.properties?.id })}
|
{#snippet children({ feature })}
|
||||||
class="rounded-full w-15 h-15 border-2 border-immich-primary shadow-lg hover:border-immich-dark-primary transition-all duration-200 hover:scale-150 object-cover bg-immich-primary"
|
<div
|
||||||
alt={feature.properties?.city && feature.properties.country
|
class="rounded-full w-10 h-10 bg-immich-primary text-white flex justify-center items-center font-mono font-bold shadow-lg hover:bg-immich-dark-primary transition-all duration-200 hover:text-immich-dark-bg opacity-90"
|
||||||
? $t('map_marker_for_images', {
|
>
|
||||||
values: { city: feature.properties.city, country: feature.properties.country },
|
{feature.properties?.point_count?.toLocaleString()}
|
||||||
})
|
</div>
|
||||||
: $t('map_marker_with_image')}
|
{/snippet}
|
||||||
/>
|
</MarkerLayer>
|
||||||
{/if}
|
<MarkerLayer
|
||||||
{#if popup}
|
applyToClusters={false}
|
||||||
<Popup offset={[0, -30]} openOn="click" closeOnClickOutside>
|
asButton
|
||||||
{@render popup?.({ marker: asMarker(feature) })}
|
onclick={(event) => {
|
||||||
</Popup>
|
if (!popup) {
|
||||||
{/if}
|
handleAssetClick(event.feature.properties?.id, map);
|
||||||
{/snippet}
|
}
|
||||||
</MarkerLayer>
|
}}
|
||||||
</GeoJSON>
|
>
|
||||||
|
{#snippet children({ feature }: { feature: Feature })}
|
||||||
|
{#if useLocationPin}
|
||||||
|
<Icon icon={mdiMapMarker} size="50px" class="text-primary -translate-y-[50%]" />
|
||||||
|
{:else}
|
||||||
|
<img
|
||||||
|
src={getAssetMediaUrl({ id: feature.properties?.id })}
|
||||||
|
class="rounded-full w-15 h-15 border-2 border-immich-primary shadow-lg hover:border-immich-dark-primary transition-all duration-200 hover:scale-150 object-cover bg-immich-primary"
|
||||||
|
alt={feature.properties?.city && feature.properties.country
|
||||||
|
? $t('map_marker_for_images', {
|
||||||
|
values: { city: feature.properties.city, country: feature.properties.country },
|
||||||
|
})
|
||||||
|
: $t('map_marker_with_image')}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
|
{#if popup}
|
||||||
|
<Popup offset={[0, -30]} openOn="click" closeOnClickOutside>
|
||||||
|
{@render popup?.({ marker: asMarker(feature) })}
|
||||||
|
</Popup>
|
||||||
|
{/if}
|
||||||
|
{/snippet}
|
||||||
|
</MarkerLayer>
|
||||||
|
</GeoJSON>
|
||||||
|
{/snippet}
|
||||||
|
</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}
|
{/snippet}
|
||||||
</MapLibre>
|
</svelte:boundary>
|
||||||
|
|||||||
@@ -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',
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user