diff --git a/web/src/lib/components/faces-page/show-hide.svelte b/web/src/lib/components/faces-page/show-hide.svelte index aee90bdbe7a3a..82159c8ee7a81 100644 --- a/web/src/lib/components/faces-page/show-hide.svelte +++ b/web/src/lib/components/faces-page/show-hide.svelte @@ -1,24 +1,46 @@ + +
- dispatch('close')} /> +

Show & hide people

({countTotalPeople.toLocaleString($locale)})

@@ -37,15 +59,15 @@
- dispatch('reset')} /> + dispatch('change')} + icon={toggleIcon} + on:click={() => onChange(getNextVisibility(toggleVisibility))} />
{#if !showLoadingSpinner} - + {:else} {/if} diff --git a/web/src/routes/(user)/people/+page.svelte b/web/src/routes/(user)/people/+page.svelte index 54f703c8f3f7d..f4d318ac53fec 100644 --- a/web/src/routes/(user)/people/+page.svelte +++ b/web/src/routes/(user)/people/+page.svelte @@ -7,7 +7,7 @@ import MergeSuggestionModal from '$lib/components/faces-page/merge-suggestion-modal.svelte'; import PeopleCard from '$lib/components/faces-page/people-card.svelte'; import SetBirthDateModal from '$lib/components/faces-page/set-birth-date-modal.svelte'; - import ShowHide from '$lib/components/faces-page/show-hide.svelte'; + import ShowHide, { ToggleVisibilty } from '$lib/components/faces-page/show-hide.svelte'; import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte'; import FullScreenModal from '$lib/components/shared-components/full-screen-modal.svelte'; import { @@ -48,7 +48,7 @@ let searchName = ''; let showLoadingSpinner = false; - let toggleVisibility = false; + let toggleVisibility: ToggleVisibilty = ToggleVisibilty.VIEW_ALL; let showChangeNameModal = false; let showSetBirthDateModal = false; @@ -104,7 +104,7 @@ // Reset variables used on the "Show & hide people" modal showLoadingSpinner = false; selectHidden = false; - toggleVisibility = false; + toggleVisibility = ToggleVisibilty.VIEW_ALL; }; const handleResetVisibility = () => { @@ -116,10 +116,17 @@ people = people; }; - const handleToggleVisibility = () => { - toggleVisibility = !toggleVisibility; + const handleToggleVisibility = (toggleVisibility: ToggleVisibilty) => { for (const person of people) { - person.isHidden = toggleVisibility; + if (toggleVisibility == ToggleVisibilty.HIDE_ALL) { + person.isHidden = true; + } + if (toggleVisibility == ToggleVisibilty.VIEW_ALL) { + person.isHidden = false; + } + if (toggleVisibility == ToggleVisibilty.HIDE_UNNANEMD && !person.name) { + person.isHidden = true; + } } // trigger reactivity @@ -172,7 +179,7 @@ // Reset variables used on the "Show & hide people" modal showLoadingSpinner = false; selectHidden = false; - toggleVisibility = false; + toggleVisibility = ToggleVisibilty.VIEW_ALL; }; const handleMergeSamePerson = async (response: [PersonResponseDto, PersonResponseDto]) => { @@ -483,10 +490,10 @@ {#if selectHidden}