diff --git a/server/src/infra/repositories/person.repository.ts b/server/src/infra/repositories/person.repository.ts index bbe1b538e1..a986a0e0c0 100644 --- a/server/src/infra/repositories/person.repository.ts +++ b/server/src/infra/repositories/person.repository.ts @@ -103,11 +103,7 @@ export class PersonRepository implements IPersonRepository { return this.personRepository.findOne({ where: { id: personId } }); } - async getByName( - userId: string, - personName: string, - { withHidden }: PersonNameSearchOptions, - ): Promise { + getByName(userId: string, personName: string, { withHidden }: PersonNameSearchOptions): Promise { const queryBuilder = this.personRepository .createQueryBuilder('person') .leftJoin('person.faces', 'face') diff --git a/web/src/lib/components/faces-page/merge-face-selector.svelte b/web/src/lib/components/faces-page/merge-face-selector.svelte index 2bf15b1bc9..9a7bb025e7 100644 --- a/web/src/lib/components/faces-page/merge-face-selector.svelte +++ b/web/src/lib/components/faces-page/merge-face-selector.svelte @@ -10,10 +10,11 @@ import { NotificationType, notificationController } from '../shared-components/notification/notification'; import ConfirmDialogue from '../shared-components/confirm-dialogue.svelte'; import { handleError } from '$lib/utils/handle-error'; - import { goto, invalidateAll } from '$app/navigation'; + import { goto } from '$app/navigation'; import { AppRoute } from '$lib/constants'; import { mdiCallMerge, mdiMerge, mdiSwapHorizontal } from '@mdi/js'; import Icon from '$lib/components/elements/icon.svelte'; + import CircleIconButton from '../elements/buttons/circle-icon-button.svelte'; export let person: PersonResponseDto; let people: PersonResponseDto[] = []; @@ -69,8 +70,6 @@ message: `Merged ${count} ${count === 1 ? 'person' : 'people'}`, type: NotificationType.Info, }); - people = people.filter((person) => !results.some((result) => result.id === person.id && result.success === true)); - await invalidateAll(); dispatch('merge'); } catch (error) { handleError(error, 'Cannot merge faces'); @@ -121,14 +120,18 @@ {/each} {#if hasSelection} - - {#if selectedPeople.length === 1} - - {/if} - +
+
+
+ +
+ {#if selectedPeople.length === 1} +
+ +
+ {/if} +
+
{/if} diff --git a/web/src/routes/(user)/explore/+page.svelte b/web/src/routes/(user)/explore/+page.svelte index 669d025dad..37f094491f 100644 --- a/web/src/routes/(user)/explore/+page.svelte +++ b/web/src/routes/(user)/explore/+page.svelte @@ -22,7 +22,9 @@ OBJECTS = 'smartInfo.objects', } - const MAX_ITEMS = 12; + let MAX_ITEMS: number; + let innerWidth: number; + let screenSize: number; const getFieldItems = (items: SearchExploreResponseDto[], field: Field) => { const targetField = items.find((item) => item.fieldName === field); return targetField?.items || []; @@ -32,8 +34,16 @@ $: places = getFieldItems(data.items, Field.CITY); $: people = data.response.people.slice(0, MAX_ITEMS); $: hasPeople = data.response.total > 0; + $: { + if (innerWidth && screenSize) { + // Set the number of faces according to the screen size and the div size + MAX_ITEMS = screenSize < 768 ? Math.floor(innerWidth / 96) : Math.floor(innerWidth / 112); + } + } + + {#if hasPeople}
@@ -45,19 +55,21 @@ draggable="false">View All
-
- {#each people as person (person.id)} - - -

{person.name}

-
- {/each} +
+ {#if MAX_ITEMS} + {#each people as person (person.id)} + + +

{person.name}

+
+ {/each} + {/if}
{/if} diff --git a/web/src/routes/(user)/people/[personId]/+page.svelte b/web/src/routes/(user)/people/[personId]/+page.svelte index 7c8f2b9f22..a453a1e257 100644 --- a/web/src/routes/(user)/people/[personId]/+page.svelte +++ b/web/src/routes/(user)/people/[personId]/+page.svelte @@ -87,7 +87,7 @@ if ((people.length < 20 && name.startsWith(searchWord)) || name === '') { return; } - const timeout = setTimeout(() => (isSearchingPeople = true), 300); + const timeout = setTimeout(() => (isSearchingPeople = true), 100); try { const { data } = await api.searchApi.searchPerson({ name }); people = data; @@ -156,6 +156,7 @@ personId: data.person.id, }); previousPersonId = data.person.id; + name = data.person.name; refreshAssetGrid = !refreshAssetGrid; } }); @@ -265,7 +266,7 @@ if (viewMode === ViewMode.SUGGEST_MERGE) { return; } - + isSearchingPeople = false; isEditingName = false; }; @@ -463,7 +464,7 @@
{#if isSearchingPeople}
@@ -472,8 +473,10 @@ {:else} {#each suggestedPeople as person, index (person.id)}