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

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
6 changed files with 128 additions and 46 deletions

View File

@@ -107,14 +107,28 @@
if (viewingAssetCursor < viewingAssets.length - 1) {
await setAssetId(viewingAssets[++viewingAssetCursor]);
await navigate({ targetRoute: 'current', assetId: $viewingAsset.id });
return true;
}
return false;
}
async function navigatePrevious() {
if (viewingAssetCursor > 0) {
await setAssetId(viewingAssets[--viewingAssetCursor]);
await navigate({ targetRoute: 'current', assetId: $viewingAsset.id });
return true;
}
return false;
}
async function navigateRandom() {
if (viewingAssets.length <= 0) {
return null;
}
const index = Math.floor(Math.random() * viewingAssets.length);
const asset = await setAssetId(viewingAssets[index]);
await navigate({ targetRoute: 'current', assetId: $viewingAsset.id });
return asset;
}
</script>
@@ -132,6 +146,7 @@
showNavigation={viewingAssets.length > 1}
onNext={navigateNext}
onPrevious={navigatePrevious}
onRandom={navigateRandom}
onClose={() => {
assetViewingStore.showAssetViewer(false);
handlePromiseError(navigate({ targetRoute: 'current', assetId: null }));