mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
fix(web): keep map view open after closing asset viewer (#26980)
This commit is contained in:
committed by
GitHub
parent
9f699fdfc3
commit
958f270f0d
@@ -2,6 +2,7 @@
|
||||
import { assetViewerManager } from '$lib/managers/asset-viewer-manager.svelte';
|
||||
import { authManager } from '$lib/managers/auth-manager.svelte';
|
||||
import MapModal from '$lib/modals/MapModal.svelte';
|
||||
import { navigate } from '$lib/utils/navigation';
|
||||
import { getAlbumInfo, type AlbumResponseDto, type MapMarkerResponseDto } from '@immich/sdk';
|
||||
import { IconButton, modalManager } from '@immich/ui';
|
||||
import { mdiMapOutline } from '@mdi/js';
|
||||
@@ -15,6 +16,7 @@
|
||||
let { album }: Props = $props();
|
||||
let abortController: AbortController;
|
||||
|
||||
let returnToMap = $state(false);
|
||||
let mapMarkers: MapMarkerResponseDto[] = $state([]);
|
||||
|
||||
onMount(async () => {
|
||||
@@ -26,6 +28,13 @@
|
||||
assetViewerManager.showAssetViewer(false);
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
if (!assetViewerManager.isViewing && returnToMap) {
|
||||
returnToMap = false;
|
||||
void onClick();
|
||||
}
|
||||
});
|
||||
|
||||
async function loadMapMarkers() {
|
||||
if (abortController) {
|
||||
abortController.abort();
|
||||
@@ -54,7 +63,10 @@
|
||||
const onClick = async () => {
|
||||
const assetIds = await modalManager.show(MapModal, { mapMarkers });
|
||||
if (assetIds) {
|
||||
await assetViewerManager.setAssetId(assetIds[0]);
|
||||
await navigate({ targetRoute: 'current', assetId: assetIds[0] });
|
||||
returnToMap = true;
|
||||
} else {
|
||||
returnToMap = false;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user