mirror of
https://github.com/immich-app/immich.git
synced 2025-06-02 13:14:54 -04:00
feat(web): Allow showing hidden people in image asset details view (#5420)
* Allow showing hidden people in image asset details view This makes it possible to easily find people/faces that have accidentally been hidden. Unhiding them still requires clicking on the person to go to their page to unhide them. * Update web/src/lib/components/asset-viewer/detail-panel.svelte Co-authored-by: martin <74269598+martabal@users.noreply.github.com> --------- Co-authored-by: brokeh <git@brocky.net> Co-authored-by: martin <74269598+martabal@users.noreply.github.com>
This commit is contained in:
parent
ec92608024
commit
a02e91169d
@ -98,7 +98,7 @@ export function mapAsset(entity: AssetEntity, options: AssetMapOptions = {}): As
|
|||||||
tags: entity.tags?.map(mapTag),
|
tags: entity.tags?.map(mapTag),
|
||||||
people: entity.faces
|
people: entity.faces
|
||||||
?.map(mapFace)
|
?.map(mapFace)
|
||||||
.filter((person): person is PersonResponseDto => person !== null && !person.isHidden)
|
.filter((person): person is PersonResponseDto => person !== null)
|
||||||
.reduce((people, person) => {
|
.reduce((people, person) => {
|
||||||
const existingPerson = people.find((p) => p.id === person.id);
|
const existingPerson = people.find((p) => p.id === person.id);
|
||||||
if (!existingPerson) {
|
if (!existingPerson) {
|
||||||
|
@ -19,8 +19,11 @@
|
|||||||
mdiImageOutline,
|
mdiImageOutline,
|
||||||
mdiMapMarkerOutline,
|
mdiMapMarkerOutline,
|
||||||
mdiInformationOutline,
|
mdiInformationOutline,
|
||||||
|
mdiEye,
|
||||||
|
mdiEyeOff,
|
||||||
} from '@mdi/js';
|
} from '@mdi/js';
|
||||||
import Icon from '$lib/components/elements/icon.svelte';
|
import Icon from '$lib/components/elements/icon.svelte';
|
||||||
|
import CircleIconButton from '../elements/buttons/circle-icon-button.svelte';
|
||||||
import Map from '../shared-components/map/map.svelte';
|
import Map from '../shared-components/map/map.svelte';
|
||||||
import { websocketStore } from '$lib/stores/websocket';
|
import { websocketStore } from '$lib/stores/websocket';
|
||||||
import { AppRoute } from '$lib/constants';
|
import { AppRoute } from '$lib/constants';
|
||||||
@ -57,6 +60,7 @@
|
|||||||
})();
|
})();
|
||||||
|
|
||||||
$: people = asset.people || [];
|
$: people = asset.people || [];
|
||||||
|
$: showingHiddenPeople = false;
|
||||||
|
|
||||||
const unsubscribe = websocketStore.onAssetUpdate.subscribe((assetUpdate) => {
|
const unsubscribe = websocketStore.onAssetUpdate.subscribe((assetUpdate) => {
|
||||||
if (assetUpdate && assetUpdate.id === asset.id) {
|
if (assetUpdate && assetUpdate.id === asset.id) {
|
||||||
@ -177,15 +181,26 @@
|
|||||||
|
|
||||||
{#if !api.isSharedLink && people.length > 0}
|
{#if !api.isSharedLink && people.length > 0}
|
||||||
<section class="px-4 py-4 text-sm">
|
<section class="px-4 py-4 text-sm">
|
||||||
|
<div class="flex h-10 w-full items-center justify-between">
|
||||||
<h2>PEOPLE</h2>
|
<h2>PEOPLE</h2>
|
||||||
|
{#if people.some((person) => person.isHidden)}
|
||||||
|
<CircleIconButton
|
||||||
|
title="Show hidden people"
|
||||||
|
icon={showingHiddenPeople ? mdiEyeOff : mdiEye}
|
||||||
|
padding="1"
|
||||||
|
on:click={() => (showingHiddenPeople = !showingHiddenPeople)}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mt-4 flex flex-wrap gap-2">
|
<div class="mt-2 flex flex-wrap gap-2">
|
||||||
{#each people as person (person.id)}
|
{#each people as person (person.id)}
|
||||||
<a
|
<a
|
||||||
href="/people/{person.id}?previousRoute={albumId ? `${AppRoute.ALBUMS}/${albumId}` : AppRoute.PHOTOS}"
|
href="/people/{person.id}?previousRoute={albumId ? `${AppRoute.ALBUMS}/${albumId}` : AppRoute.PHOTOS}"
|
||||||
class="w-[90px]"
|
class="w-[90px] {!showingHiddenPeople && person.isHidden ? 'hidden' : ''}"
|
||||||
on:click={() => dispatch('close-viewer')}
|
on:click={() => dispatch('close-viewer')}
|
||||||
>
|
>
|
||||||
|
<div class="relative">
|
||||||
<ImageThumbnail
|
<ImageThumbnail
|
||||||
curve
|
curve
|
||||||
shadow
|
shadow
|
||||||
@ -195,7 +210,9 @@
|
|||||||
widthStyle="90px"
|
widthStyle="90px"
|
||||||
heightStyle="90px"
|
heightStyle="90px"
|
||||||
thumbhash={null}
|
thumbhash={null}
|
||||||
|
hidden={person.isHidden}
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
<p class="mt-1 truncate font-medium" title={person.name}>{person.name}</p>
|
<p class="mt-1 truncate font-medium" title={person.name}>{person.name}</p>
|
||||||
{#if person.birthDate}
|
{#if person.birthDate}
|
||||||
{@const personBirthDate = DateTime.fromISO(person.birthDate)}
|
{@const personBirthDate = DateTime.fromISO(person.birthDate)}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user