From b88f98bf66a4cec9f2d0c5ee77b1bcf6dcf92344 Mon Sep 17 00:00:00 2001 From: Ben <35833890+IMBeniamin@users.noreply.github.com> Date: Mon, 23 Dec 2024 19:26:53 +0100 Subject: [PATCH] feat(web): Add "set as featured" option for an asset (#14879) --- i18n/en.json | 1 + .../actions/set-person-featured-action.svelte | 29 +++++++++++++++++++ .../asset-viewer/asset-viewer-nav-bar.svelte | 7 +++++ .../asset-viewer/asset-viewer.svelte | 4 +++ .../components/photos-page/asset-grid.svelte | 5 +++- .../[[assetId=id]]/+page.svelte | 1 + 6 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 web/src/lib/components/asset-viewer/actions/set-person-featured-action.svelte diff --git a/i18n/en.json b/i18n/en.json index e1538db1e4..b5f8f3ca9a 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -1142,6 +1142,7 @@ "set": "Set", "set_as_album_cover": "Set as album cover", "set_as_profile_picture": "Set as profile picture", + "set_as_featured_photo": "Set as featured photo", "set_date_of_birth": "Set date of birth", "set_profile_picture": "Set profile picture", "set_slideshow_to_fullscreen": "Set Slideshow to fullscreen", diff --git a/web/src/lib/components/asset-viewer/actions/set-person-featured-action.svelte b/web/src/lib/components/asset-viewer/actions/set-person-featured-action.svelte new file mode 100644 index 0000000000..70e1c4f1ba --- /dev/null +++ b/web/src/lib/components/asset-viewer/actions/set-person-featured-action.svelte @@ -0,0 +1,29 @@ + + + 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 65ca01b58a..442302198b 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 @@ -9,6 +9,7 @@ import FavoriteAction from '$lib/components/asset-viewer/actions/favorite-action.svelte'; import RestoreAction from '$lib/components/asset-viewer/actions/restore-action.svelte'; import SetAlbumCoverAction from '$lib/components/asset-viewer/actions/set-album-cover-action.svelte'; + import SetFeaturedPhotoAction from '$lib/components/asset-viewer/actions/set-person-featured-action.svelte'; import SetProfilePictureAction from '$lib/components/asset-viewer/actions/set-profile-picture-action.svelte'; import ShareAction from '$lib/components/asset-viewer/actions/share-action.svelte'; import ShowDetailAction from '$lib/components/asset-viewer/actions/show-detail-action.svelte'; @@ -27,6 +28,7 @@ AssetTypeEnum, type AlbumResponseDto, type AssetResponseDto, + type PersonResponseDto, type StackResponseDto, } from '@immich/sdk'; import { @@ -50,6 +52,7 @@ interface Props { asset: AssetResponseDto; album?: AlbumResponseDto | null; + person?: PersonResponseDto | null; stack?: StackResponseDto | null; showDetailButton: boolean; showSlideshow?: boolean; @@ -67,6 +70,7 @@ let { asset, album = null, + person = null, stack = null, showDetailButton, showSlideshow = false, @@ -169,6 +173,9 @@ {#if album} {/if} + {#if person} + + {/if} {#if asset.type === AssetTypeEnum.Image} {/if} diff --git a/web/src/lib/components/asset-viewer/asset-viewer.svelte b/web/src/lib/components/asset-viewer/asset-viewer.svelte index 69acc5bb0a..7a2f97bb65 100644 --- a/web/src/lib/components/asset-viewer/asset-viewer.svelte +++ b/web/src/lib/components/asset-viewer/asset-viewer.svelte @@ -30,6 +30,7 @@ type ActivityResponseDto, type AlbumResponseDto, type AssetResponseDto, + type PersonResponseDto, type StackResponseDto, } from '@immich/sdk'; import { onDestroy, onMount, untrack } from 'svelte'; @@ -56,6 +57,7 @@ withStacked?: boolean; isShared?: boolean; album?: AlbumResponseDto | null; + person?: PersonResponseDto | null; onAction?: OnAction | undefined; reactions?: ActivityResponseDto[]; onClose: (dto: { asset: AssetResponseDto }) => void; @@ -72,6 +74,7 @@ withStacked = false, isShared = false, album = null, + person = null, onAction = undefined, reactions = $bindable([]), onClose, @@ -429,6 +432,7 @@ void; onEscape?: () => void; @@ -70,6 +71,7 @@ showArchiveIcon = false, isShared = false, album = null, + person = null, isShowDeleteConfirmation = $bindable(false), onSelect = () => {}, onEscape = () => {}, @@ -914,6 +916,7 @@ preloadAssets={$preloadAssets} {isShared} {album} + {person} onAction={handleAction} onPrevious={handlePrevious} onNext={handleNext} 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 6788c678ed..e1e50cfb2e 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 @@ -454,6 +454,7 @@ {#key person.id}