diff --git a/web/src/lib/components/album-page/album-viewer.svelte b/web/src/lib/components/album-page/album-viewer.svelte index c03918bb6d..2d5b7ddb06 100644 --- a/web/src/lib/components/album-page/album-viewer.svelte +++ b/web/src/lib/components/album-page/album-viewer.svelte @@ -24,7 +24,7 @@ import ShareVariantOutline from 'svelte-material-icons/ShareVariantOutline.svelte'; import Button from '../elements/buttons/button.svelte'; import CircleIconButton from '../elements/buttons/circle-icon-button.svelte'; - import DownloadFiles from '../photos-page/actions/download-files.svelte'; + import DownloadAction from '../photos-page/actions/download-action.svelte'; import RemoveFromAlbum from '../photos-page/actions/remove-from-album.svelte'; import AssetSelectControlBar from '../photos-page/asset-select-control-bar.svelte'; import CircleAvatar from '../shared-components/circle-avatar.svelte'; @@ -338,7 +338,7 @@ assets={multiSelectAsset} clearSelect={() => (multiSelectAsset = new Set())} > - + {#if isOwned} {/if} diff --git a/web/src/lib/components/asset-viewer/asset-viewer-nav-bar.svelte b/web/src/lib/components/asset-viewer/asset-viewer-nav-bar.svelte index 7ea7ac2843..daaea852be 100644 --- a/web/src/lib/components/asset-viewer/asset-viewer-nav-bar.svelte +++ b/web/src/lib/components/asset-viewer/asset-viewer-nav-bar.svelte @@ -15,8 +15,6 @@ import ContentCopy from 'svelte-material-icons/ContentCopy.svelte'; import MotionPlayOutline from 'svelte-material-icons/MotionPlayOutline.svelte'; import MotionPauseOutline from 'svelte-material-icons/MotionPauseOutline.svelte'; - import ArchiveArrowDownOutline from 'svelte-material-icons/ArchiveArrowDownOutline.svelte'; - import ArchiveArrowUpOutline from 'svelte-material-icons/ArchiveArrowUpOutline.svelte'; import { page } from '$app/stores'; import { AssetResponseDto } from '../../../api'; @@ -52,15 +50,6 @@ dispatch('goBack')} />
- {#if isOwner} - dispatch('toggleArchive')} - /> - {/if} - {#if showMotionPlayButton} {#if isMotionPhotoPlaying} onMenuClick('addToSharedAlbum')} text="Add to Shared Album" /> + + {#if isOwner} + dispatch('toggleArchive')} + text={asset.isArchived ? 'Unarchive' : 'Archive'} + /> + {/if} {/if} diff --git a/web/src/lib/components/photos-page/menu-options/option-add-to-album.svelte b/web/src/lib/components/photos-page/actions/add-to-album.svelte similarity index 100% rename from web/src/lib/components/photos-page/menu-options/option-add-to-album.svelte rename to web/src/lib/components/photos-page/actions/add-to-album.svelte diff --git a/web/src/lib/components/photos-page/actions/archive-action.svelte b/web/src/lib/components/photos-page/actions/archive-action.svelte new file mode 100644 index 0000000000..e959f4c6b8 --- /dev/null +++ b/web/src/lib/components/photos-page/actions/archive-action.svelte @@ -0,0 +1,51 @@ + + +{#if menuItem} + +{:else} + +{/if} diff --git a/web/src/lib/components/photos-page/actions/delete-assets.svelte b/web/src/lib/components/photos-page/actions/delete-assets.svelte index 8857b5c216..f11c7c5c0e 100644 --- a/web/src/lib/components/photos-page/actions/delete-assets.svelte +++ b/web/src/lib/components/photos-page/actions/delete-assets.svelte @@ -7,39 +7,47 @@ import { api } from '@api'; import DeleteOutline from 'svelte-material-icons/DeleteOutline.svelte'; import { OnAssetDelete, getAssetControlContext } from '../asset-select-control-bar.svelte'; + import ConfirmDialogue from '$lib/components/shared-components/confirm-dialogue.svelte'; + import { handleError } from '../../../utils/handle-error'; export let onAssetDelete: OnAssetDelete; const { getAssets, clearSelect } = getAssetControlContext(); - const deleteSelectedAssetHandler = async () => { + let confirm = false; + + const handleDelete = async () => { try { - if ( - window.confirm( - `Caution! Are you sure you want to delete ${ - getAssets().size - } assets? This step also deletes assets in the album(s) to which they belong. You can not undo this action!` - ) - ) { - const { data: deletedAssets } = await api.assetApi.deleteAsset({ - ids: Array.from(getAssets()).map((a) => a.id) - }); + let count = 0; - for (const asset of deletedAssets) { - if (asset.status === 'SUCCESS') { - onAssetDelete(asset.id); - } - } - - clearSelect(); - } - } catch (e) { - notificationController.show({ - type: NotificationType.Error, - message: 'Error deleting assets, check console for more details' + const { data: deletedAssets } = await api.assetApi.deleteAsset({ + ids: Array.from(getAssets()).map((a) => a.id) }); - console.error('Error deleteSelectedAssetHandler', e); + + for (const asset of deletedAssets) { + if (asset.status === 'SUCCESS') { + onAssetDelete(asset.id); + count++; + } + } + + notificationController.show({ message: `Deleted ${count}`, type: NotificationType.Info }); + + clearSelect(); + } catch (e) { + handleError(e, 'Error deleting assets'); } }; - + (confirm = true)} /> + +{#if confirm} + (confirm = false)} + /> +{/if} diff --git a/web/src/lib/components/photos-page/actions/download-files.svelte b/web/src/lib/components/photos-page/actions/download-action.svelte similarity index 67% rename from web/src/lib/components/photos-page/actions/download-files.svelte rename to web/src/lib/components/photos-page/actions/download-action.svelte index 2792697231..cb37214e08 100644 --- a/web/src/lib/components/photos-page/actions/download-files.svelte +++ b/web/src/lib/components/photos-page/actions/download-action.svelte @@ -2,10 +2,12 @@ import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte'; import { bulkDownload } from '$lib/utils/asset-utils'; import CloudDownloadOutline from 'svelte-material-icons/CloudDownloadOutline.svelte'; + import MenuOption from '../../shared-components/context-menu/menu-option.svelte'; import { getAssetControlContext } from '../asset-select-control-bar.svelte'; export let filename = 'immich'; export let sharedLinkKey: string | undefined = undefined; + export let menuItem = false; const { getAssets, clearSelect } = getAssetControlContext(); @@ -14,4 +16,8 @@ }; - +{#if menuItem} + +{:else} + +{/if} diff --git a/web/src/lib/components/photos-page/actions/favorite-action.svelte b/web/src/lib/components/photos-page/actions/favorite-action.svelte new file mode 100644 index 0000000000..0b268322e7 --- /dev/null +++ b/web/src/lib/components/photos-page/actions/favorite-action.svelte @@ -0,0 +1,50 @@ + + +{#if menuItem} + +{:else} + +{/if} diff --git a/web/src/lib/components/photos-page/actions/move-to-archive.svelte b/web/src/lib/components/photos-page/actions/move-to-archive.svelte deleted file mode 100644 index c56304b124..0000000000 --- a/web/src/lib/components/photos-page/actions/move-to-archive.svelte +++ /dev/null @@ -1,40 +0,0 @@ - - - diff --git a/web/src/lib/components/photos-page/actions/remove-favorite.svelte b/web/src/lib/components/photos-page/actions/remove-favorite.svelte deleted file mode 100644 index 611a38dc3c..0000000000 --- a/web/src/lib/components/photos-page/actions/remove-favorite.svelte +++ /dev/null @@ -1,36 +0,0 @@ - - - - - diff --git a/web/src/lib/components/photos-page/actions/remove-from-archive.svelte b/web/src/lib/components/photos-page/actions/remove-from-archive.svelte deleted file mode 100644 index b24a67ec22..0000000000 --- a/web/src/lib/components/photos-page/actions/remove-from-archive.svelte +++ /dev/null @@ -1,39 +0,0 @@ - - - diff --git a/web/src/lib/components/photos-page/menu-options/option-add-to-favorites.svelte b/web/src/lib/components/photos-page/menu-options/option-add-to-favorites.svelte deleted file mode 100644 index 1c38d46694..0000000000 --- a/web/src/lib/components/photos-page/menu-options/option-add-to-favorites.svelte +++ /dev/null @@ -1,41 +0,0 @@ - - - diff --git a/web/src/lib/components/photos-page/menu-options/option-remove-from-favorites.svelte b/web/src/lib/components/photos-page/menu-options/option-remove-from-favorites.svelte deleted file mode 100644 index 4a2d2781e0..0000000000 --- a/web/src/lib/components/photos-page/menu-options/option-remove-from-favorites.svelte +++ /dev/null @@ -1,19 +0,0 @@ - - - - { - closeMenu(); - handleRemoveFavorite(); - }} - text="Remove from favorites" - /> - diff --git a/web/src/lib/components/share-page/individual-shared-viewer.svelte b/web/src/lib/components/share-page/individual-shared-viewer.svelte index 12510e52c9..347b7abbfc 100644 --- a/web/src/lib/components/share-page/individual-shared-viewer.svelte +++ b/web/src/lib/components/share-page/individual-shared-viewer.svelte @@ -7,7 +7,7 @@ import FileImagePlusOutline from 'svelte-material-icons/FileImagePlusOutline.svelte'; import FolderDownloadOutline from 'svelte-material-icons/FolderDownloadOutline.svelte'; import CircleIconButton from '../elements/buttons/circle-icon-button.svelte'; - import DownloadFiles from '../photos-page/actions/download-files.svelte'; + import DownloadAction from '../photos-page/actions/download-action.svelte'; import RemoveFromSharedLink from '../photos-page/actions/remove-from-shared-link.svelte'; import AssetSelectControlBar from '../photos-page/asset-select-control-bar.svelte'; import ControlAppBar from '../shared-components/control-app-bar.svelte'; @@ -60,7 +60,7 @@
{#if isMultiSelectionMode} - + {#if isOwned} {/if} diff --git a/web/src/lib/components/shared-components/full-screen-modal.svelte b/web/src/lib/components/shared-components/full-screen-modal.svelte index bd9428d279..063db78e71 100644 --- a/web/src/lib/components/shared-components/full-screen-modal.svelte +++ b/web/src/lib/components/shared-components/full-screen-modal.svelte @@ -9,7 +9,7 @@
dispatch('clickOutside')}> diff --git a/web/src/routes/(user)/archive/+page.svelte b/web/src/routes/(user)/archive/+page.svelte index 6c4669ef91..5a4e1529b6 100644 --- a/web/src/routes/(user)/archive/+page.svelte +++ b/web/src/routes/(user)/archive/+page.svelte @@ -1,19 +1,20 @@ {#if isMultiSelectionMode} - (multiSelectAsset = new Set())} - > + (selectedAssets = new Set())}> - - - - - + + + + + + + + onAssetDelete(asset.id)} + /> - {:else}
diff --git a/web/src/routes/(user)/photos/+page.svelte b/web/src/routes/(user)/photos/+page.svelte index 0f0a8c4f1a..91d521a96a 100644 --- a/web/src/routes/(user)/photos/+page.svelte +++ b/web/src/routes/(user)/photos/+page.svelte @@ -1,14 +1,14 @@ @@ -34,14 +37,16 @@ clearSelect={assetInteractionStore.clearMultiselect} > - assetStore.removeAsset(asset.id)} /> - - - - + + + + + + assetStore.removeAsset(asset.id)} /> + {/if} diff --git a/web/src/routes/(user)/search/+page.svelte b/web/src/routes/(user)/search/+page.svelte index 96c9361e75..1c215834fe 100644 --- a/web/src/routes/(user)/search/+page.svelte +++ b/web/src/routes/(user)/search/+page.svelte @@ -1,21 +1,20 @@