1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-06 06:07:29 +02:00

refactor(web): asset grid stores (#3464)

* Refactor asset grid stores

* Iterate over buckets with for..of loop

* Rebase on top of main branch changes
This commit is contained in:
Sergey Kondrikov
2023-08-01 04:27:56 +03:00
committed by GitHub
parent 13051c1e5a
commit 5f9dfa9493
15 changed files with 330 additions and 265 deletions

View File

@ -11,7 +11,7 @@
import { flip } from 'svelte/animate';
import { archivedAsset } from '$lib/stores/archived-asset.store';
import { getThumbnailSize } from '$lib/utils/thumbnail-util';
import { isViewingAssetStoreState } from '$lib/stores/asset-interaction.store';
import { assetViewingStore } from '$lib/stores/asset-viewing.store';
export let assets: AssetResponseDto[];
export let sharedLink: SharedLinkResponseDto | undefined = undefined;
@ -20,6 +20,8 @@
export let viewFrom: ViewFrom;
export let showArchiveIcon = false;
let { isViewing: showAssetViewer } = assetViewingStore;
let selectedAsset: AssetResponseDto;
let currentViewAssetIndex = 0;
@ -33,7 +35,7 @@
currentViewAssetIndex = assets.findIndex((a) => a.id == asset.id);
selectedAsset = assets[currentViewAssetIndex];
$isViewingAssetStoreState = true;
$showAssetViewer = true;
pushState(selectedAsset.id);
};
@ -81,7 +83,7 @@
};
const closeViewer = () => {
$isViewingAssetStoreState = false;
$showAssetViewer = false;
history.pushState(null, '', `${$page.url.pathname}`);
};
@ -117,7 +119,7 @@
{/if}
<!-- Overlay Asset Viewer -->
{#if $isViewingAssetStoreState}
{#if $showAssetViewer}
<AssetViewer
asset={selectedAsset}
publicSharedKey={sharedLink?.key}