mirror of
https://github.com/samsonjs/immich.git
synced 2026-04-27 15:07:45 +00:00
fix(web): show correct assets in memory gallery (#26157)
This commit is contained in:
parent
9f6dbf710c
commit
1cf3a80840
2 changed files with 11 additions and 6 deletions
|
|
@ -68,7 +68,8 @@
|
||||||
let currentMemoryAssetFull = $derived.by(async () =>
|
let currentMemoryAssetFull = $derived.by(async () =>
|
||||||
current?.asset ? await getAssetInfo({ ...authManager.params, id: current.asset.id }) : undefined,
|
current?.asset ? await getAssetInfo({ ...authManager.params, id: current.asset.id }) : undefined,
|
||||||
);
|
);
|
||||||
let currentTimelineAssets = $derived([
|
let currentTimelineAssets = $derived(current?.memory.assets ?? []);
|
||||||
|
let viewerAssets = $derived([
|
||||||
...(current?.previousMemory?.assets ?? []),
|
...(current?.previousMemory?.assets ?? []),
|
||||||
...(current?.memory.assets ?? []),
|
...(current?.memory.assets ?? []),
|
||||||
...(current?.nextMemory?.assets ?? []),
|
...(current?.nextMemory?.assets ?? []),
|
||||||
|
|
@ -657,6 +658,7 @@
|
||||||
>
|
>
|
||||||
<GalleryViewer
|
<GalleryViewer
|
||||||
assets={currentTimelineAssets}
|
assets={currentTimelineAssets}
|
||||||
|
{viewerAssets}
|
||||||
viewport={galleryViewport}
|
viewport={galleryViewport}
|
||||||
{assetInteraction}
|
{assetInteraction}
|
||||||
slidingWindowOffset={viewerHeight}
|
slidingWindowOffset={viewerHeight}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
assets: AssetResponseDto[];
|
assets: AssetResponseDto[];
|
||||||
|
viewerAssets?: AssetResponseDto[];
|
||||||
assetInteraction: AssetInteraction;
|
assetInteraction: AssetInteraction;
|
||||||
disableAssetSelect?: boolean;
|
disableAssetSelect?: boolean;
|
||||||
showArchiveIcon?: boolean;
|
showArchiveIcon?: boolean;
|
||||||
|
|
@ -48,6 +49,7 @@
|
||||||
|
|
||||||
let {
|
let {
|
||||||
assets = $bindable(),
|
assets = $bindable(),
|
||||||
|
viewerAssets,
|
||||||
assetInteraction,
|
assetInteraction,
|
||||||
disableAssetSelect = false,
|
disableAssetSelect = false,
|
||||||
showArchiveIcon = false,
|
showArchiveIcon = false,
|
||||||
|
|
@ -61,6 +63,7 @@
|
||||||
}: Props = $props();
|
}: Props = $props();
|
||||||
|
|
||||||
let { isViewing: isViewerOpen, asset: viewingAsset } = assetViewingStore;
|
let { isViewing: isViewerOpen, asset: viewingAsset } = assetViewingStore;
|
||||||
|
const navigationAssets = $derived(viewerAssets ?? assets);
|
||||||
|
|
||||||
const geometry = $derived(
|
const geometry = $derived(
|
||||||
getJustifiedLayoutFromAssets(assets, {
|
getJustifiedLayoutFromAssets(assets, {
|
||||||
|
|
@ -282,12 +285,12 @@
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleRandom = async (): Promise<{ id: string } | undefined> => {
|
const handleRandom = async (): Promise<{ id: string } | undefined> => {
|
||||||
if (assets.length === 0) {
|
if (navigationAssets.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const randomIndex = Math.floor(Math.random() * assets.length);
|
const randomIndex = Math.floor(Math.random() * navigationAssets.length);
|
||||||
const asset = assets[randomIndex];
|
const asset = navigationAssets[randomIndex];
|
||||||
|
|
||||||
await navigateToAsset(asset);
|
await navigateToAsset(asset);
|
||||||
return asset;
|
return asset;
|
||||||
|
|
@ -344,8 +347,8 @@
|
||||||
|
|
||||||
const assetCursor = $derived({
|
const assetCursor = $derived({
|
||||||
current: $viewingAsset,
|
current: $viewingAsset,
|
||||||
nextAsset: getNextAsset(assets, $viewingAsset),
|
nextAsset: getNextAsset(navigationAssets, $viewingAsset),
|
||||||
previousAsset: getPreviousAsset(assets, $viewingAsset),
|
previousAsset: getPreviousAsset(navigationAssets, $viewingAsset),
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue