fix(web): no trash actions when trash is empty (#32104)

fix(web): no trash actions when trash is empty (#32097)

(cherry picked from commit c826e0d45aaa62187189921e9ac40297b13a37c4)

Co-authored-by: Mees Frensel <33722705+meesfrensel@users.noreply.github.com>
This commit is contained in:
immich-push-o-matic[bot]
2026-10-05 14:59:47 +00:00
committed by GitHub
co-authored by Mees Frensel
parent 34bec01232
commit 17e4cfd96b
2 changed files with 6 additions and 4 deletions
+5 -3
View File
@@ -5,23 +5,25 @@ import type { MessageFormatter } from 'svelte-i18n';
import { handleError } from '$lib/utils/handle-error';
import { getFormatter } from '$lib/utils/i18n';
export const getTrashActions = ($t: MessageFormatter) => {
export const getTrashActions = ($t: MessageFormatter, assetCount: number) => {
const RestoreAll: ActionItem = {
title: $t('restore_all'),
icon: mdiHistory,
$if: () => assetCount > 0,
onAction: () => handleRestoreTrash(),
};
const Empty: ActionItem = {
title: $t('empty_trash'),
icon: mdiDeleteForeverOutline,
$if: () => assetCount > 0,
onAction: () => handleEmptyTrash(),
};
return { RestoreAll, Empty };
};
export const handleEmptyTrash = async () => {
const handleEmptyTrash = async () => {
const $t = await getFormatter();
const confirmed = await modalManager.showDialog({ prompt: $t('empty_trash_confirmation') });
@@ -37,7 +39,7 @@ export const handleEmptyTrash = async () => {
}
};
export const handleRestoreTrash = async () => {
const handleRestoreTrash = async () => {
const $t = await getFormatter();
const confirmed = await modalManager.showDialog({ prompt: $t('assets_restore_confirmation') });
@@ -40,7 +40,7 @@
return;
};
const { Empty, RestoreAll } = $derived(getTrashActions($t));
const { Empty, RestoreAll } = $derived(getTrashActions($t, timelineManager?.assetCount ?? 0));
</script>
{#if featureFlagsManager.value.trash}