1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-23 20:22:45 +01:00

fix(web): escape key to clear selection and go to previous page () ()

This commit is contained in:
Jin Xuan 2025-01-10 23:27:35 +08:00 committed by GitHub
parent f9db60f25b
commit 3030e74fc3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 48 additions and 5 deletions
web/src/routes/(user)
albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]
archive/[[photos=photos]]/[[assetId=id]]
favorites/[[photos=photos]]/[[assetId=id]]
partners/[userId]/[[photos=photos]]/[[assetId=id]]
trash/[[photos=photos]]/[[assetId=id]]

View file

@ -215,7 +215,10 @@
viewMode = AlbumPageViewMode.VIEW;
return;
}
if (viewMode === AlbumPageViewMode.SELECT_THUMBNAIL) {
viewMode = AlbumPageViewMode.VIEW;
return;
}
if (viewMode === AlbumPageViewMode.SELECT_ASSETS) {
await handleCloseSelectAssets();
return;

View file

@ -28,6 +28,13 @@
const assetStore = new AssetStore({ isArchived: true });
const assetInteraction = new AssetInteraction();
const handleEscape = () => {
if (assetInteraction.selectionActive) {
assetInteraction.clearMultiselect();
return;
}
};
onDestroy(() => {
assetStore.destroy();
});
@ -54,7 +61,13 @@
{/if}
<UserPageLayout hideNavbar={assetInteraction.selectionActive} title={data.meta.title} scrollbar={false}>
<AssetGrid enableRouting={true} {assetStore} {assetInteraction} removeAction={AssetAction.UNARCHIVE}>
<AssetGrid
enableRouting={true}
{assetStore}
{assetInteraction}
removeAction={AssetAction.UNARCHIVE}
onEscape={handleEscape}
>
{#snippet empty()}
<EmptyPlaceholder text={$t('no_archived_assets_message')} />
{/snippet}

View file

@ -32,6 +32,13 @@
const assetStore = new AssetStore({ isFavorite: true });
const assetInteraction = new AssetInteraction();
const handleEscape = () => {
if (assetInteraction.selectionActive) {
assetInteraction.clearMultiselect();
return;
}
};
onDestroy(() => {
assetStore.destroy();
});
@ -68,7 +75,13 @@
{/if}
<UserPageLayout hideNavbar={assetInteraction.selectionActive} title={data.meta.title} scrollbar={false}>
<AssetGrid enableRouting={true} {assetStore} {assetInteraction} removeAction={AssetAction.UNFAVORITE}>
<AssetGrid
enableRouting={true}
{assetStore}
{assetInteraction}
removeAction={AssetAction.UNFAVORITE}
onEscape={handleEscape}
>
{#snippet empty()}
<EmptyPlaceholder text={$t('no_favorites_message')} />
{/snippet}

View file

@ -24,6 +24,13 @@
const assetStore = new AssetStore({ userId: data.partner.id, isArchived: false, withStacked: true });
const assetInteraction = new AssetInteraction();
const handleEscape = () => {
if (assetInteraction.selectionActive) {
assetInteraction.clearMultiselect();
return;
}
};
onDestroy(() => {
assetStore.destroy();
});
@ -51,5 +58,5 @@
{/snippet}
</ControlAppBar>
{/if}
<AssetGrid enableRouting={true} {assetStore} {assetInteraction} />
<AssetGrid enableRouting={true} {assetStore} {assetInteraction} onEscape={handleEscape} />
</main>

View file

@ -87,6 +87,13 @@
}
};
const handleEscape = () => {
if (assetInteraction.selectionActive) {
assetInteraction.clearMultiselect();
return;
}
};
onDestroy(() => {
assetStore.destroy();
});
@ -122,7 +129,7 @@
</div>
{/snippet}
<AssetGrid enableRouting={true} {assetStore} {assetInteraction}>
<AssetGrid enableRouting={true} {assetStore} {assetInteraction} onEscape={handleEscape}>
<p class="font-medium text-gray-500/60 dark:text-gray-300/60 p-4">
{$t('trashed_items_will_be_permanently_deleted_after', { values: { days: $serverConfig.trashDays } })}
</p>