From e40c7c51ee0cec49a7d1cd33f714401e0308f97f Mon Sep 17 00:00:00 2001 From: Travis Menghini Date: Wed, 11 Dec 2024 10:31:11 -0600 Subject: [PATCH] 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 --- web/src/lib/components/memory-page/memory-viewer.svelte | 6 ++++++ .../[[photos=photos]]/[[assetId=id]]/+page.svelte | 6 ++++++ .../search/[[photos=photos]]/[[assetId=id]]/+page.svelte | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/web/src/lib/components/memory-page/memory-viewer.svelte b/web/src/lib/components/memory-page/memory-viewer.svelte index 72723670e6..65ef47c9ca 100644 --- a/web/src/lib/components/memory-page/memory-viewer.svelte +++ b/web/src/lib/components/memory-page/memory-viewer.svelte @@ -46,6 +46,8 @@ import { tweened } from 'svelte/motion'; import { derived as storeDerived } from 'svelte/store'; 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 = { memoryIndex: number; @@ -221,6 +223,7 @@ $effect(() => { handlePromiseError(handleAction(galleryInView ? 'pause' : 'play')); }); + let isAllUserOwned = $derived([...$selectedAssets].every((asset) => asset.ownerId === $user.id)); + {#if $preferences.tags.enabled && isAllUserOwned} + + {/if} diff --git a/web/src/routes/(user)/people/[personId]/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/people/[personId]/[[photos=photos]]/[[assetId=id]]/+page.svelte index 48e194dda4..143a19dd5c 100644 --- a/web/src/routes/(user)/people/[personId]/[[photos=photos]]/[[assetId=id]]/+page.svelte +++ b/web/src/routes/(user)/people/[personId]/[[photos=photos]]/[[assetId=id]]/+page.svelte @@ -58,6 +58,8 @@ import { listNavigation } from '$lib/actions/list-navigation'; import { t } from 'svelte-i18n'; 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 { data: PageData; @@ -337,6 +339,7 @@ let isAllArchive = $derived([...$selectedAssets].every((asset) => asset.isArchived)); let isAllFavorite = $derived([...$selectedAssets].every((asset) => asset.isFavorite)); + let isAllUserOwned = $derived([...$selectedAssets].every((asset) => asset.ownerId === $user.id)); {#if viewMode === PersonPageViewMode.UNASSIGN_ASSETS} @@ -391,6 +394,9 @@ $assetStore.removeAssets(assetIds)} /> + {#if $preferences.tags.enabled && isAllUserOwned} + + {/if} $assetStore.removeAssets(assetIds)} /> diff --git a/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelte index c800dd7014..7372f05e77 100644 --- a/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelte +++ b/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelte @@ -44,6 +44,8 @@ import { t } from 'svelte-i18n'; import { onMount, tick } from '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; let { isViewing: showAssetViewer } = assetViewingStore; @@ -229,6 +231,7 @@ function getObjectKeys(obj: T): (keyof T)[] { return Object.keys(obj) as (keyof T)[]; } + let isAllUserOwned = $derived([...$selectedAssets].every((asset) => asset.ownerId === $user.id)); @@ -250,6 +253,9 @@ + {#if $preferences.tags.enabled && isAllUserOwned} + + {/if}