fix: delete/archive from keyboard updates count
parent
3e06b637cc
commit
08066086d4
|
|
@ -54,6 +54,8 @@
|
||||||
isShowDeleteConfirmation?: boolean;
|
isShowDeleteConfirmation?: boolean;
|
||||||
onSelect?: (asset: TimelineAsset) => void;
|
onSelect?: (asset: TimelineAsset) => void;
|
||||||
onEscape?: () => void;
|
onEscape?: () => void;
|
||||||
|
onKeyboardDelete?: (assetIds: string[]) => void;
|
||||||
|
onKeyboardArchive?: (ids: string[]) => void;
|
||||||
children?: Snippet;
|
children?: Snippet;
|
||||||
empty?: Snippet;
|
empty?: Snippet;
|
||||||
customThumbnailLayout?: Snippet<[TimelineAsset]>;
|
customThumbnailLayout?: Snippet<[TimelineAsset]>;
|
||||||
|
|
@ -87,6 +89,8 @@
|
||||||
isShowDeleteConfirmation = $bindable(false),
|
isShowDeleteConfirmation = $bindable(false),
|
||||||
onSelect = () => {},
|
onSelect = () => {},
|
||||||
onEscape = () => {},
|
onEscape = () => {},
|
||||||
|
onKeyboardDelete,
|
||||||
|
onKeyboardArchive,
|
||||||
children,
|
children,
|
||||||
empty,
|
empty,
|
||||||
customThumbnailLayout,
|
customThumbnailLayout,
|
||||||
|
|
@ -604,6 +608,8 @@
|
||||||
{assetInteraction}
|
{assetInteraction}
|
||||||
bind:isShowDeleteConfirmation
|
bind:isShowDeleteConfirmation
|
||||||
{onEscape}
|
{onEscape}
|
||||||
|
onAssetDelete={onKeyboardDelete}
|
||||||
|
onArchive={onKeyboardArchive}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{#if timelineManager.months.length > 0}
|
{#if timelineManager.months.length > 0}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@
|
||||||
assetInteraction: AssetInteraction;
|
assetInteraction: AssetInteraction;
|
||||||
isShowDeleteConfirmation: boolean;
|
isShowDeleteConfirmation: boolean;
|
||||||
onEscape?: () => void;
|
onEscape?: () => void;
|
||||||
|
onAssetDelete?: (assetIds: string[]) => void;
|
||||||
|
onArchive?: (ids: string[]) => void;
|
||||||
scrollToAsset: (asset: TimelineAsset) => boolean;
|
scrollToAsset: (asset: TimelineAsset) => boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -35,6 +37,8 @@
|
||||||
assetInteraction,
|
assetInteraction,
|
||||||
isShowDeleteConfirmation = $bindable(false),
|
isShowDeleteConfirmation = $bindable(false),
|
||||||
onEscape,
|
onEscape,
|
||||||
|
onAssetDelete,
|
||||||
|
onArchive,
|
||||||
scrollToAsset,
|
scrollToAsset,
|
||||||
}: Props = $props();
|
}: Props = $props();
|
||||||
|
|
||||||
|
|
@ -44,7 +48,10 @@
|
||||||
isShowDeleteConfirmation = false;
|
isShowDeleteConfirmation = false;
|
||||||
await deleteAssets(
|
await deleteAssets(
|
||||||
!(isTrashEnabled && !force),
|
!(isTrashEnabled && !force),
|
||||||
(assetIds) => timelineManager.removeAssets(assetIds),
|
(assetIds) => {
|
||||||
|
timelineManager.removeAssets(assetIds);
|
||||||
|
onAssetDelete?.(assetIds);
|
||||||
|
},
|
||||||
assetInteraction.selectedAssets,
|
assetInteraction.selectedAssets,
|
||||||
!isTrashEnabled || force ? undefined : (assets) => timelineManager.upsertAssets(assets),
|
!isTrashEnabled || force ? undefined : (assets) => timelineManager.upsertAssets(assets),
|
||||||
);
|
);
|
||||||
|
|
@ -81,6 +88,7 @@
|
||||||
const visibility = assetInteraction.isAllArchived ? AssetVisibility.Timeline : AssetVisibility.Archive;
|
const visibility = assetInteraction.isAllArchived ? AssetVisibility.Timeline : AssetVisibility.Archive;
|
||||||
const ids = await archiveAssets(assetInteraction.selectedAssets, visibility);
|
const ids = await archiveAssets(assetInteraction.selectedAssets, visibility);
|
||||||
timelineManager.update(ids, (asset) => (asset.visibility = visibility));
|
timelineManager.update(ids, (asset) => (asset.visibility = visibility));
|
||||||
|
onArchive?.(ids);
|
||||||
deselectAllAssets();
|
deselectAllAssets();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -368,6 +368,8 @@
|
||||||
singleSelect={viewMode === PersonPageViewMode.SELECT_PERSON}
|
singleSelect={viewMode === PersonPageViewMode.SELECT_PERSON}
|
||||||
onSelect={handleSelectFeaturePhoto}
|
onSelect={handleSelectFeaturePhoto}
|
||||||
onEscape={handleEscape}
|
onEscape={handleEscape}
|
||||||
|
onKeyboardDelete={() => updateAssetCount()}
|
||||||
|
onKeyboardArchive={() => updateAssetCount()}
|
||||||
>
|
>
|
||||||
{#if viewMode === PersonPageViewMode.VIEW_ASSETS}
|
{#if viewMode === PersonPageViewMode.VIEW_ASSETS}
|
||||||
<!-- Person information block -->
|
<!-- Person information block -->
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue