Files
immich/web/src/lib/components/asset-viewer/ImagePanoramaViewer.svelte
T
midzelis 4544371c3d feat(web): hero view transitions between timeline and asset viewer
Change-Id: I19e0c7385cc38adbc85177ae9706cff06a6a6964

fix(web): fix e2e test failures for view transitions

Change-Id: Ida64f2d509efce0a85a50b89fd4137276a6a6964
Change-Id: I19e0c7385cc38adbc85177ae9706cff06a6a6964
2026-05-04 14:05:07 +00:00

31 lines
1.0 KiB
Svelte

<script lang="ts">
import { authManager } from '$lib/managers/auth-manager.svelte';
import { getAssetUrl } from '$lib/utils';
import { AssetMediaSize, viewAsset, type AssetResponseDto } from '@immich/sdk';
import { LoadingSpinner } from '@immich/ui';
import { t } from 'svelte-i18n';
type Props = {
asset: AssetResponseDto;
};
let { asset }: Props = $props();
const assetId = $derived(asset.id);
const loadAssetData = async (id: string) => {
const data = await viewAsset({ ...authManager.params, id, size: AssetMediaSize.Preview });
return URL.createObjectURL(data);
};
</script>
<div class="flex h-dvh w-dvw place-content-center place-items-center select-none">
{#await Promise.all([loadAssetData(assetId), import('./PhotoSphereViewerAdapter.svelte')])}
<LoadingSpinner />
{:then [data, { default: PhotoSphereViewer }]}
<PhotoSphereViewer panorama={data} originalPanorama={getAssetUrl({ asset, forceOriginal: true })} />
{:catch}
{$t('errors.failed_to_load_asset')}
{/await}
</div>