mirror of
https://github.com/immich-app/immich.git
synced 2025-01-01 08:31:59 +00:00
feat(web): improve feedback for favorite and archive actions (#7232)
This commit is contained in:
parent
b3c7bebbd4
commit
b896d45ee7
11 changed files with 24 additions and 12 deletions
|
@ -11,7 +11,7 @@
|
||||||
import MenuOption from '../../shared-components/context-menu/menu-option.svelte';
|
import MenuOption from '../../shared-components/context-menu/menu-option.svelte';
|
||||||
import { getAssetControlContext } from '../asset-select-control-bar.svelte';
|
import { getAssetControlContext } from '../asset-select-control-bar.svelte';
|
||||||
|
|
||||||
export let onArchive: OnArchive | undefined = undefined;
|
export let onArchive: OnArchive;
|
||||||
|
|
||||||
export let menuItem = false;
|
export let menuItem = false;
|
||||||
export let unarchive = false;
|
export let unarchive = false;
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
asset.isArchived = isArchived;
|
asset.isArchived = isArchived;
|
||||||
}
|
}
|
||||||
|
|
||||||
onArchive?.(ids, isArchived);
|
onArchive(ids, isArchived);
|
||||||
|
|
||||||
notificationController.show({
|
notificationController.show({
|
||||||
message: `${isArchived ? 'Archived' : 'Unarchived'} ${ids.length}`,
|
message: `${isArchived ? 'Archived' : 'Unarchived'} ${ids.length}`,
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
import { mdiHeartMinusOutline, mdiHeartOutline, mdiTimerSand } from '@mdi/js';
|
import { mdiHeartMinusOutline, mdiHeartOutline, mdiTimerSand } from '@mdi/js';
|
||||||
import { getAssetControlContext } from '../asset-select-control-bar.svelte';
|
import { getAssetControlContext } from '../asset-select-control-bar.svelte';
|
||||||
|
|
||||||
export let onFavorite: OnFavorite | undefined = undefined;
|
export let onFavorite: OnFavorite;
|
||||||
|
|
||||||
export let menuItem = false;
|
export let menuItem = false;
|
||||||
export let removeFavorite: boolean;
|
export let removeFavorite: boolean;
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
asset.isFavorite = isFavorite;
|
asset.isFavorite = isFavorite;
|
||||||
}
|
}
|
||||||
|
|
||||||
onFavorite?.(ids, isFavorite);
|
onFavorite(ids, isFavorite);
|
||||||
|
|
||||||
notificationController.show({
|
notificationController.show({
|
||||||
message: isFavorite ? `Added ${ids.length} to favorites` : `Removed ${ids.length} from favorites`,
|
message: isFavorite ? `Added ${ids.length} to favorites` : `Removed ${ids.length} from favorites`,
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
export let viewport: Viewport;
|
export let viewport: Viewport;
|
||||||
export let singleSelect = false;
|
export let singleSelect = false;
|
||||||
export let withStacked = false;
|
export let withStacked = false;
|
||||||
|
export let showArchiveIcon = false;
|
||||||
|
|
||||||
export let assetStore: AssetStore;
|
export let assetStore: AssetStore;
|
||||||
export let assetInteractionStore: AssetInteractionStore;
|
export let assetInteractionStore: AssetInteractionStore;
|
||||||
|
@ -170,6 +171,7 @@
|
||||||
>
|
>
|
||||||
<Thumbnail
|
<Thumbnail
|
||||||
showStackedIcon={withStacked}
|
showStackedIcon={withStacked}
|
||||||
|
{showArchiveIcon}
|
||||||
{asset}
|
{asset}
|
||||||
{groupIndex}
|
{groupIndex}
|
||||||
on:click={() => assetClickHandler(asset, groupAssets, groupTitle)}
|
on:click={() => assetClickHandler(asset, groupAssets, groupTitle)}
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
export let assetInteractionStore: AssetInteractionStore;
|
export let assetInteractionStore: AssetInteractionStore;
|
||||||
export let removeAction: AssetAction | null = null;
|
export let removeAction: AssetAction | null = null;
|
||||||
export let withStacked = false;
|
export let withStacked = false;
|
||||||
|
export let showArchiveIcon = false;
|
||||||
export let isShared = false;
|
export let isShared = false;
|
||||||
export let album: AlbumResponseDto | null = null;
|
export let album: AlbumResponseDto | null = null;
|
||||||
export let isShowDeleteConfirmation = false;
|
export let isShowDeleteConfirmation = false;
|
||||||
|
@ -425,6 +426,7 @@
|
||||||
{#if intersecting}
|
{#if intersecting}
|
||||||
<AssetDateGroup
|
<AssetDateGroup
|
||||||
{withStacked}
|
{withStacked}
|
||||||
|
{showArchiveIcon}
|
||||||
{assetStore}
|
{assetStore}
|
||||||
{assetInteractionStore}
|
{assetInteractionStore}
|
||||||
{isSelectionMode}
|
{isSelectionMode}
|
||||||
|
|
|
@ -416,6 +416,10 @@ export class AssetStore {
|
||||||
return nextBucket.assets[0]?.id || null;
|
return nextBucket.assets[0]?.id || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
triggerUpdate() {
|
||||||
|
this.emit(false);
|
||||||
|
}
|
||||||
|
|
||||||
private emit(recalculate: boolean) {
|
private emit(recalculate: boolean) {
|
||||||
if (recalculate) {
|
if (recalculate) {
|
||||||
this.assets = this.buckets.flatMap(({ assets }) => assets);
|
this.assets = this.buckets.flatMap(({ assets }) => assets);
|
||||||
|
|
|
@ -127,6 +127,7 @@
|
||||||
$: isOwned = $user.id == album.ownerId;
|
$: isOwned = $user.id == album.ownerId;
|
||||||
$: isAllUserOwned = [...$selectedAssets].every((asset) => asset.ownerId === $user.id);
|
$: isAllUserOwned = [...$selectedAssets].every((asset) => asset.ownerId === $user.id);
|
||||||
$: isAllFavorite = [...$selectedAssets].every((asset) => asset.isFavorite);
|
$: isAllFavorite = [...$selectedAssets].every((asset) => asset.isFavorite);
|
||||||
|
$: isAllArchived = [...$selectedAssets].every((asset) => asset.isArchived);
|
||||||
$: {
|
$: {
|
||||||
assetGridWidth = isShowActivity ? globalWidth - (globalWidth < 768 ? 360 : 460) : globalWidth;
|
assetGridWidth = isShowActivity ? globalWidth - (globalWidth < 768 ? 360 : 460) : globalWidth;
|
||||||
}
|
}
|
||||||
|
@ -473,9 +474,9 @@
|
||||||
</AssetSelectContextMenu>
|
</AssetSelectContextMenu>
|
||||||
<AssetSelectContextMenu icon={mdiDotsVertical} title="Menu">
|
<AssetSelectContextMenu icon={mdiDotsVertical} title="Menu">
|
||||||
{#if isAllUserOwned}
|
{#if isAllUserOwned}
|
||||||
<FavoriteAction menuItem removeFavorite={isAllFavorite} />
|
<FavoriteAction menuItem removeFavorite={isAllFavorite} onFavorite={() => assetStore.triggerUpdate()} />
|
||||||
|
<ArchiveAction menuItem unarchive={isAllArchived} onArchive={() => assetStore.triggerUpdate()} />
|
||||||
{/if}
|
{/if}
|
||||||
<ArchiveAction menuItem />
|
|
||||||
<DownloadAction menuItem filename="{album.albumName}.zip" />
|
<DownloadAction menuItem filename="{album.albumName}.zip" />
|
||||||
{#if isOwned || isAllUserOwned}
|
{#if isOwned || isAllUserOwned}
|
||||||
<RemoveFromAlbum menuItem bind:album onRemove={(assetIds) => handleRemoveAssets(assetIds)} />
|
<RemoveFromAlbum menuItem bind:album onRemove={(assetIds) => handleRemoveAssets(assetIds)} />
|
||||||
|
@ -591,6 +592,7 @@
|
||||||
isShared={album.sharedUsers.length > 0}
|
isShared={album.sharedUsers.length > 0}
|
||||||
isSelectionMode={viewMode === ViewMode.SELECT_THUMBNAIL}
|
isSelectionMode={viewMode === ViewMode.SELECT_THUMBNAIL}
|
||||||
singleSelect={viewMode === ViewMode.SELECT_THUMBNAIL}
|
singleSelect={viewMode === ViewMode.SELECT_THUMBNAIL}
|
||||||
|
showArchiveIcon
|
||||||
on:select={({ detail: asset }) => handleUpdateThumbnail(asset.id)}
|
on:select={({ detail: asset }) => handleUpdateThumbnail(asset.id)}
|
||||||
on:escape={handleEscape}
|
on:escape={handleEscape}
|
||||||
>
|
>
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
<DeleteAssets onAssetDelete={(assetId) => assetStore.removeAsset(assetId)} />
|
<DeleteAssets onAssetDelete={(assetId) => assetStore.removeAsset(assetId)} />
|
||||||
<AssetSelectContextMenu icon={mdiDotsVertical} title="Add">
|
<AssetSelectContextMenu icon={mdiDotsVertical} title="Add">
|
||||||
<DownloadAction menuItem />
|
<DownloadAction menuItem />
|
||||||
<FavoriteAction menuItem removeFavorite={isAllFavorite} />
|
<FavoriteAction menuItem removeFavorite={isAllFavorite} onFavorite={() => assetStore.triggerUpdate()} />
|
||||||
</AssetSelectContextMenu>
|
</AssetSelectContextMenu>
|
||||||
</AssetSelectControlBar>
|
</AssetSelectControlBar>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
<DeleteAssets onAssetDelete={(assetId) => assetStore.removeAsset(assetId)} />
|
<DeleteAssets onAssetDelete={(assetId) => assetStore.removeAsset(assetId)} />
|
||||||
<AssetSelectContextMenu icon={mdiDotsVertical} title="Menu">
|
<AssetSelectContextMenu icon={mdiDotsVertical} title="Menu">
|
||||||
<DownloadAction menuItem />
|
<DownloadAction menuItem />
|
||||||
<ArchiveAction menuItem unarchive={isAllArchive} />
|
<ArchiveAction menuItem unarchive={isAllArchive} onArchive={(ids) => assetStore.removeAssets(ids)} />
|
||||||
<ChangeDate menuItem />
|
<ChangeDate menuItem />
|
||||||
<ChangeLocation menuItem />
|
<ChangeLocation menuItem />
|
||||||
</AssetSelectContextMenu>
|
</AssetSelectContextMenu>
|
||||||
|
|
|
@ -446,7 +446,7 @@
|
||||||
<DeleteAssets onAssetDelete={(assetId) => $assetStore.removeAsset(assetId)} />
|
<DeleteAssets onAssetDelete={(assetId) => $assetStore.removeAsset(assetId)} />
|
||||||
<AssetSelectContextMenu icon={mdiDotsVertical} title="Add">
|
<AssetSelectContextMenu icon={mdiDotsVertical} title="Add">
|
||||||
<DownloadAction menuItem filename="{data.person.name || 'immich'}.zip" />
|
<DownloadAction menuItem filename="{data.person.name || 'immich'}.zip" />
|
||||||
<FavoriteAction menuItem removeFavorite={isAllFavorite} />
|
<FavoriteAction menuItem removeFavorite={isAllFavorite} onFavorite={() => assetStore.triggerUpdate()} />
|
||||||
<ArchiveAction menuItem unarchive={isAllArchive} onArchive={(ids) => $assetStore.removeAssets(ids)} />
|
<ArchiveAction menuItem unarchive={isAllArchive} onArchive={(ids) => $assetStore.removeAssets(ids)} />
|
||||||
<MenuOption text="Fix incorrect match" on:click={handleReassignAssets} />
|
<MenuOption text="Fix incorrect match" on:click={handleReassignAssets} />
|
||||||
<ChangeDate menuItem />
|
<ChangeDate menuItem />
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
onAssetDelete={(assetId) => assetStore.removeAsset(assetId)}
|
onAssetDelete={(assetId) => assetStore.removeAsset(assetId)}
|
||||||
/>
|
/>
|
||||||
<AssetSelectContextMenu icon={mdiDotsVertical} title="Menu">
|
<AssetSelectContextMenu icon={mdiDotsVertical} title="Menu">
|
||||||
<FavoriteAction menuItem removeFavorite={isAllFavorite} />
|
<FavoriteAction menuItem removeFavorite={isAllFavorite} onFavorite={() => assetStore.triggerUpdate()} />
|
||||||
<DownloadAction menuItem />
|
<DownloadAction menuItem />
|
||||||
<ArchiveAction menuItem onArchive={(ids) => assetStore.removeAssets(ids)} />
|
<ArchiveAction menuItem onArchive={(ids) => assetStore.removeAssets(ids)} />
|
||||||
{#if $selectedAssets.size > 1}
|
{#if $selectedAssets.size > 1}
|
||||||
|
|
|
@ -223,6 +223,8 @@
|
||||||
|
|
||||||
return personNames.join(', ');
|
return personNames.join(', ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const triggerAssetUpdate = () => (searchResultAssets = searchResultAssets);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
|
@ -239,8 +241,8 @@
|
||||||
|
|
||||||
<AssetSelectContextMenu icon={mdiDotsVertical} title="Add">
|
<AssetSelectContextMenu icon={mdiDotsVertical} title="Add">
|
||||||
<DownloadAction menuItem />
|
<DownloadAction menuItem />
|
||||||
<FavoriteAction menuItem removeFavorite={isAllFavorite} />
|
<FavoriteAction menuItem removeFavorite={isAllFavorite} onFavorite={triggerAssetUpdate} />
|
||||||
<ArchiveAction menuItem unarchive={isAllArchived} />
|
<ArchiveAction menuItem unarchive={isAllArchived} onArchive={triggerAssetUpdate} />
|
||||||
<ChangeDate menuItem />
|
<ChangeDate menuItem />
|
||||||
<ChangeLocation menuItem />
|
<ChangeLocation menuItem />
|
||||||
</AssetSelectContextMenu>
|
</AssetSelectContextMenu>
|
||||||
|
|
Loading…
Reference in a new issue