1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2024-12-29 15:11:58 +00:00

feat(web): allow tags to be applied in bulk on search, personID, and memory-viewer pages (#14368)

* Allow Tags to be applied in bulk on search page

* Added Tags Action To PersonID Page

* Fixed Formatting Issues

* Added Tags Option to Memory-Viewer
This commit is contained in:
Travis Menghini 2024-12-11 10:31:11 -06:00 committed by GitHub
parent 11f585d0ad
commit e40c7c51ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 18 additions and 0 deletions

View file

@ -46,6 +46,8 @@
import { tweened } from 'svelte/motion'; import { tweened } from 'svelte/motion';
import { derived as storeDerived } from 'svelte/store'; import { derived as storeDerived } from 'svelte/store';
import { fade } from 'svelte/transition'; import { fade } from 'svelte/transition';
import { preferences, user } from '$lib/stores/user.store';
import TagAction from '$lib/components/photos-page/actions/tag-action.svelte';
type MemoryIndex = { type MemoryIndex = {
memoryIndex: number; memoryIndex: number;
@ -221,6 +223,7 @@
$effect(() => { $effect(() => {
handlePromiseError(handleAction(galleryInView ? 'pause' : 'play')); handlePromiseError(handleAction(galleryInView ? 'pause' : 'play'));
}); });
let isAllUserOwned = $derived([...$selectedAssets].every((asset) => asset.ownerId === $user.id));
</script> </script>
<svelte:window <svelte:window
@ -253,6 +256,9 @@
<ChangeDate menuItem /> <ChangeDate menuItem />
<ChangeLocation menuItem /> <ChangeLocation menuItem />
<ArchiveAction menuItem unarchive={isAllArchived} onArchive={handleRemove} /> <ArchiveAction menuItem unarchive={isAllArchived} onArchive={handleRemove} />
{#if $preferences.tags.enabled && isAllUserOwned}
<TagAction menuItem />
{/if}
<DeleteAssets menuItem onAssetDelete={handleRemove} /> <DeleteAssets menuItem onAssetDelete={handleRemove} />
</ButtonContextMenu> </ButtonContextMenu>
</AssetSelectControlBar> </AssetSelectControlBar>

View file

@ -58,6 +58,8 @@
import { listNavigation } from '$lib/actions/list-navigation'; import { listNavigation } from '$lib/actions/list-navigation';
import { t } from 'svelte-i18n'; import { t } from 'svelte-i18n';
import ButtonContextMenu from '$lib/components/shared-components/context-menu/button-context-menu.svelte'; import ButtonContextMenu from '$lib/components/shared-components/context-menu/button-context-menu.svelte';
import { preferences, user } from '$lib/stores/user.store';
import TagAction from '$lib/components/photos-page/actions/tag-action.svelte';
interface Props { interface Props {
data: PageData; data: PageData;
@ -337,6 +339,7 @@
let isAllArchive = $derived([...$selectedAssets].every((asset) => asset.isArchived)); let isAllArchive = $derived([...$selectedAssets].every((asset) => asset.isArchived));
let isAllFavorite = $derived([...$selectedAssets].every((asset) => asset.isFavorite)); let isAllFavorite = $derived([...$selectedAssets].every((asset) => asset.isFavorite));
let isAllUserOwned = $derived([...$selectedAssets].every((asset) => asset.ownerId === $user.id));
</script> </script>
{#if viewMode === PersonPageViewMode.UNASSIGN_ASSETS} {#if viewMode === PersonPageViewMode.UNASSIGN_ASSETS}
@ -391,6 +394,9 @@
<ChangeDate menuItem /> <ChangeDate menuItem />
<ChangeLocation menuItem /> <ChangeLocation menuItem />
<ArchiveAction menuItem unarchive={isAllArchive} onArchive={(assetIds) => $assetStore.removeAssets(assetIds)} /> <ArchiveAction menuItem unarchive={isAllArchive} onArchive={(assetIds) => $assetStore.removeAssets(assetIds)} />
{#if $preferences.tags.enabled && isAllUserOwned}
<TagAction menuItem />
{/if}
<DeleteAssets menuItem onAssetDelete={(assetIds) => $assetStore.removeAssets(assetIds)} /> <DeleteAssets menuItem onAssetDelete={(assetIds) => $assetStore.removeAssets(assetIds)} />
</ButtonContextMenu> </ButtonContextMenu>
</AssetSelectControlBar> </AssetSelectControlBar>

View file

@ -44,6 +44,8 @@
import { t } from 'svelte-i18n'; import { t } from 'svelte-i18n';
import { onMount, tick } from 'svelte'; import { onMount, tick } from 'svelte';
import AssetJobActions from '$lib/components/photos-page/actions/asset-job-actions.svelte'; import AssetJobActions from '$lib/components/photos-page/actions/asset-job-actions.svelte';
import { preferences, user } from '$lib/stores/user.store';
import TagAction from '$lib/components/photos-page/actions/tag-action.svelte';
const MAX_ASSET_COUNT = 5000; const MAX_ASSET_COUNT = 5000;
let { isViewing: showAssetViewer } = assetViewingStore; let { isViewing: showAssetViewer } = assetViewingStore;
@ -229,6 +231,7 @@
function getObjectKeys<T extends object>(obj: T): (keyof T)[] { function getObjectKeys<T extends object>(obj: T): (keyof T)[] {
return Object.keys(obj) as (keyof T)[]; return Object.keys(obj) as (keyof T)[];
} }
let isAllUserOwned = $derived([...$selectedAssets].every((asset) => asset.ownerId === $user.id));
</script> </script>
<svelte:window use:shortcut={{ shortcut: { key: 'Escape' }, onShortcut: onEscape }} bind:scrollY /> <svelte:window use:shortcut={{ shortcut: { key: 'Escape' }, onShortcut: onEscape }} bind:scrollY />
@ -250,6 +253,9 @@
<ChangeDate menuItem /> <ChangeDate menuItem />
<ChangeLocation menuItem /> <ChangeLocation menuItem />
<ArchiveAction menuItem unarchive={isAllArchived} onArchive={triggerAssetUpdate} /> <ArchiveAction menuItem unarchive={isAllArchived} onArchive={triggerAssetUpdate} />
{#if $preferences.tags.enabled && isAllUserOwned}
<TagAction menuItem />
{/if}
<DeleteAssets menuItem {onAssetDelete} /> <DeleteAssets menuItem {onAssetDelete} />
<hr /> <hr />
<AssetJobActions /> <AssetJobActions />