mirror of
https://github.com/immich-app/immich.git
synced 2024-11-24 08:52:28 +02:00
fix(web): reset select all button state on escape press (#13600)
* factor out cancel multiselect state logic to utils * use cancel multiselct helper in album page * use cancel multiselct helper in album-viewer component * use cancel multiselct helper in asset-grid component * remove unused to fix lint
This commit is contained in:
parent
ee0130a58b
commit
45517ab7ae
@ -6,7 +6,7 @@
|
||||
import type { AlbumResponseDto, SharedLinkResponseDto, UserResponseDto } from '@immich/sdk';
|
||||
import { createAssetInteractionStore } from '$lib/stores/asset-interaction.store';
|
||||
import { AssetStore } from '$lib/stores/assets.store';
|
||||
import { downloadAlbum } from '$lib/utils/asset-utils';
|
||||
import { cancelMultiselect, downloadAlbum } from '$lib/utils/asset-utils';
|
||||
import CircleIconButton from '../elements/buttons/circle-icon-button.svelte';
|
||||
import DownloadAction from '../photos-page/actions/download-action.svelte';
|
||||
import AssetGrid from '../photos-page/asset-grid.svelte';
|
||||
@ -49,7 +49,7 @@
|
||||
shortcut: { key: 'Escape' },
|
||||
onShortcut: () => {
|
||||
if (!$showAssetViewer && $isMultiSelectState) {
|
||||
assetInteractionStore.clearMultiselect();
|
||||
cancelMultiselect(assetInteractionStore);
|
||||
}
|
||||
},
|
||||
}}
|
||||
|
@ -3,7 +3,7 @@
|
||||
import type { AssetInteractionStore } from '$lib/stores/asset-interaction.store';
|
||||
import { type AssetStore, isSelectingAllAssets } from '$lib/stores/assets.store';
|
||||
import { mdiSelectAll, mdiSelectRemove } from '@mdi/js';
|
||||
import { selectAllAssets } from '$lib/utils/asset-utils';
|
||||
import { selectAllAssets, cancelMultiselect } from '$lib/utils/asset-utils';
|
||||
import { t } from 'svelte-i18n';
|
||||
|
||||
export let assetStore: AssetStore;
|
||||
@ -14,8 +14,7 @@
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
$isSelectingAllAssets = false;
|
||||
assetInteractionStore.clearMultiselect();
|
||||
cancelMultiselect(assetInteractionStore);
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -5,19 +5,13 @@
|
||||
import { AppRoute, AssetAction } from '$lib/constants';
|
||||
import type { AssetInteractionStore } from '$lib/stores/asset-interaction.store';
|
||||
import { assetViewingStore } from '$lib/stores/asset-viewing.store';
|
||||
import {
|
||||
AssetBucket,
|
||||
AssetStore,
|
||||
isSelectingAllAssets,
|
||||
type BucketListener,
|
||||
type ViewportXY,
|
||||
} from '$lib/stores/assets.store';
|
||||
import { AssetBucket, AssetStore, type BucketListener, type ViewportXY } from '$lib/stores/assets.store';
|
||||
import { locale, showDeleteModal } from '$lib/stores/preferences.store';
|
||||
import { isSearchEnabled } from '$lib/stores/search.store';
|
||||
import { featureFlags } from '$lib/stores/server-config.store';
|
||||
import { handlePromiseError } from '$lib/utils';
|
||||
import { deleteAssets } from '$lib/utils/actions';
|
||||
import { archiveAssets, selectAllAssets, stackAssets } from '$lib/utils/asset-utils';
|
||||
import { archiveAssets, cancelMultiselect, selectAllAssets, stackAssets } from '$lib/utils/asset-utils';
|
||||
import { navigate } from '$lib/utils/navigation';
|
||||
import {
|
||||
formatGroupTitle,
|
||||
@ -589,8 +583,7 @@
|
||||
let shiftKeyIsDown = false;
|
||||
|
||||
const deselectAllAssets = () => {
|
||||
$isSelectingAllAssets = false;
|
||||
assetInteractionStore.clearMultiselect();
|
||||
cancelMultiselect(assetInteractionStore);
|
||||
};
|
||||
|
||||
const onKeyDown = (event: KeyboardEvent) => {
|
||||
|
@ -467,6 +467,11 @@ export const selectAllAssets = async (assetStore: AssetStore, assetInteractionSt
|
||||
}
|
||||
};
|
||||
|
||||
export const cancelMultiselect = (assetInteractionStore: AssetInteractionStore) => {
|
||||
isSelectingAllAssets.set(false);
|
||||
assetInteractionStore.clearMultiselect();
|
||||
};
|
||||
|
||||
export const toggleArchive = async (asset: AssetResponseDto) => {
|
||||
const $t = get(t);
|
||||
try {
|
||||
|
@ -40,7 +40,7 @@
|
||||
import { SlideshowNavigation, SlideshowState, slideshowStore } from '$lib/stores/slideshow.store';
|
||||
import { preferences, user } from '$lib/stores/user.store';
|
||||
import { handlePromiseError } from '$lib/utils';
|
||||
import { downloadAlbum } from '$lib/utils/asset-utils';
|
||||
import { downloadAlbum, cancelMultiselect } from '$lib/utils/asset-utils';
|
||||
import { openFileUploadDialog } from '$lib/utils/file-uploader';
|
||||
import { handleError } from '$lib/utils/handle-error';
|
||||
import {
|
||||
@ -270,7 +270,7 @@
|
||||
return;
|
||||
}
|
||||
if ($isMultiSelectState) {
|
||||
assetInteractionStore.clearMultiselect();
|
||||
cancelMultiselect(assetInteractionStore);
|
||||
return;
|
||||
}
|
||||
await goto(backUrl);
|
||||
|
Loading…
Reference in New Issue
Block a user