feat: redesign asset-viewer previous/next and hide when nav not possible (#24903)

This commit is contained in:
Min Idzelis
2026-01-15 06:55:01 -05:00
committed by GitHub
parent d59ee7d2ae
commit 80a5444bf4
14 changed files with 299 additions and 321 deletions
@@ -23,7 +23,6 @@
let { assets, onResolve, onStack }: Props = $props();
const { isViewing: showAssetViewer, asset: viewingAsset, setAsset } = assetViewingStore;
const getAssetIndex = (id: string) => assets.findIndex((asset) => asset.id === id);
// eslint-disable-next-line svelte/no-unnecessary-state-wrap
let selectedAssetIds = $state(new SvelteSet<string>());
@@ -44,24 +43,6 @@
assetViewingStore.showAssetViewer(false);
});
const onNext = async () => {
const index = getAssetIndex($viewingAsset.id) + 1;
if (index >= assets.length) {
return false;
}
await onViewAsset(assets[index]);
return true;
};
const onPrevious = async () => {
const index = getAssetIndex($viewingAsset.id) - 1;
if (index < 0) {
return false;
}
await onViewAsset(assets[index]);
return true;
};
const onRandom = async () => {
if (assets.length <= 0) {
return;
@@ -191,8 +172,6 @@
<AssetViewer
cursor={assetCursor}
showNavigation={assets.length > 1}
{onNext}
{onPrevious}
{onRandom}
onClose={() => {
assetViewingStore.showAssetViewer(false);