feat(web): Slideshow is enabled everywhere. It no longer needs assetStore. ()

Slideshow no longer needs assetStore. It is enabled everywhere

Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
Mattia Natali 2025-01-14 15:24:58 +01:00 committed by GitHub
parent f70ee3f350
commit 4279cd6e1e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 128 additions and 46 deletions
web/src/lib/components/photos-page

View file

@ -527,6 +527,18 @@
return !!nextAsset;
};
const handleRandom = async () => {
const randomAsset = await $assetStore.getRandomAsset();
if (randomAsset) {
const preloadAsset = await $assetStore.getNextAsset(randomAsset);
assetViewingStore.setAsset(randomAsset, preloadAsset ? [preloadAsset] : []);
await navigate({ targetRoute: 'current', assetId: randomAsset.id });
}
return randomAsset;
};
const handleClose = async ({ asset }: { asset: AssetResponseDto }) => {
assetViewingStore.showAssetViewer(false);
showSkeleton = true;
@ -911,7 +923,6 @@
{#await import('../asset-viewer/asset-viewer.svelte') then { default: AssetViewer }}
<AssetViewer
{withStacked}
{assetStore}
asset={$viewingAsset}
preloadAssets={$preloadAssets}
{isShared}
@ -920,6 +931,7 @@
onAction={handleAction}
onPrevious={handlePrevious}
onNext={handleNext}
onRandom={handleRandom}
onClose={handleClose}
/>
{/await}