Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions web/src/lib/components/timeline/Timeline.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
isShowDeleteConfirmation?: boolean;
onSelect?: (asset: TimelineAsset) => void;
onEscape?: () => void;
onKeyboardDelete?: (assetIds: string[]) => void;
onKeyboardArchive?: (ids: string[]) => void;
children?: Snippet;
empty?: Snippet;
customThumbnailLayout?: Snippet<[TimelineAsset]>;
Expand Down Expand Up @@ -87,6 +89,8 @@
isShowDeleteConfirmation = $bindable(false),
onSelect = () => {},
onEscape = () => {},
onKeyboardDelete,
onKeyboardArchive,
children,
empty,
customThumbnailLayout,
Expand Down Expand Up @@ -604,6 +608,8 @@
{assetInteraction}
bind:isShowDeleteConfirmation
{onEscape}
onAssetDelete={onKeyboardDelete}
onArchive={onKeyboardArchive}
/>

{#if timelineManager.months.length > 0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
assetInteraction: AssetInteraction;
isShowDeleteConfirmation: boolean;
onEscape?: () => void;
onAssetDelete?: (assetIds: string[]) => void;
onArchive?: (ids: string[]) => void;
scrollToAsset: (asset: TimelineAsset) => boolean;
}

Expand All @@ -35,6 +37,8 @@
assetInteraction,
isShowDeleteConfirmation = $bindable(false),
onEscape,
onAssetDelete,
onArchive,
scrollToAsset,
}: Props = $props();

Expand All @@ -44,7 +48,10 @@
isShowDeleteConfirmation = false;
await deleteAssets(
!(isTrashEnabled && !force),
(assetIds) => timelineManager.removeAssets(assetIds),
(assetIds) => {
timelineManager.removeAssets(assetIds);
onAssetDelete?.(assetIds);
},
assetInteraction.selectedAssets,
!isTrashEnabled || force ? undefined : (assets) => timelineManager.upsertAssets(assets),
);
Expand Down Expand Up @@ -81,6 +88,7 @@
const visibility = assetInteraction.isAllArchived ? AssetVisibility.Timeline : AssetVisibility.Archive;
const ids = await archiveAssets(assetInteraction.selectedAssets, visibility);
timelineManager.update(ids, (asset) => (asset.visibility = visibility));
onArchive?.(ids);
deselectAllAssets();
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,7 @@
import { getPeopleThumbnailUrl } from '$lib/utils';
import { handleError } from '$lib/utils/handle-error';
import { isExternalUrl } from '$lib/utils/navigation';
import {
AssetVisibility,
getPersonStatistics,
searchPerson,
updatePerson,
type PersonResponseDto,
} from '@immich/sdk';
import { AssetVisibility, searchPerson, updatePerson, type PersonResponseDto } from '@immich/sdk';
import { LoadingSpinner, modalManager, toastManager } from '@immich/ui';
import {
mdiAccountBoxOutline,
Expand All @@ -69,7 +63,7 @@

let { data }: Props = $props();

let numberOfAssets = $state(data.statistics.assets);
let numberOfAssets = $derived(data.statistics.assets);
let { isViewing: showAssetViewer } = assetViewingStore;

let timelineManager = $state<TimelineManager>() as TimelineManager;
Expand Down Expand Up @@ -129,12 +123,7 @@
};

const updateAssetCount = async () => {
try {
const { assets } = await getPersonStatistics({ id: person.id });
numberOfAssets = assets;
} catch (error) {
handleError(error, "Can't update the asset count");
}
await invalidateAll();
};

afterNavigate(({ from }) => {
Expand Down Expand Up @@ -373,6 +362,8 @@
singleSelect={viewMode === PersonPageViewMode.SELECT_PERSON}
onSelect={handleSelectFeaturePhoto}
onEscape={handleEscape}
onKeyboardDelete={() => updateAssetCount()}
onKeyboardArchive={() => updateAssetCount()}
>
{#if viewMode === PersonPageViewMode.VIEW_ASSETS}
<!-- Person information block -->
Expand Down
Loading