diff --git a/web/src/lib/components/shared-components/search-bar/search-filter-box.svelte b/web/src/lib/components/shared-components/search-bar/search-filter-box.svelte index 35e7ea7535..4fd85fa9bd 100644 --- a/web/src/lib/components/shared-components/search-bar/search-filter-box.svelte +++ b/web/src/lib/components/shared-components/search-bar/search-filter-box.svelte @@ -77,8 +77,6 @@ : MediaType.All, }; - let filterBoxWidth = 0; - const resetForm = () => { filter = { personIds: new Set(), @@ -120,7 +118,6 @@
@@ -132,7 +129,7 @@ >
- + diff --git a/web/src/lib/components/shared-components/search-bar/search-people-section.svelte b/web/src/lib/components/shared-components/search-bar/search-people-section.svelte index 9eec526f4a..b6110c52b8 100644 --- a/web/src/lib/components/shared-components/search-bar/search-people-section.svelte +++ b/web/src/lib/components/shared-components/search-bar/search-people-section.svelte @@ -8,14 +8,14 @@ import { mdiClose, mdiArrowRight } from '@mdi/js'; import { handleError } from '$lib/utils/handle-error'; import { t } from 'svelte-i18n'; + import SingleGridRow from '$lib/components/shared-components/single-grid-row.svelte'; - export let width: number; export let selectedPeople: Set; let peoplePromise = getPeople(); let showAllPeople = false; let name = ''; - $: numberOfPeople = (width - 80) / 85; + let numberOfPeople = 1; function orderBySelectedPeopleFirst(people: PersonResponseDto[]) { return [ @@ -60,11 +60,14 @@
-
+ {#each peopleList as person (person.id)} {/each} -
+ {#if showAllPeople || people.length > peopleList.length}
diff --git a/web/src/lib/components/shared-components/single-grid-row.svelte b/web/src/lib/components/shared-components/single-grid-row.svelte new file mode 100644 index 0000000000..90020f2922 --- /dev/null +++ b/web/src/lib/components/shared-components/single-grid-row.svelte @@ -0,0 +1,38 @@ + + +
+ +
diff --git a/web/src/routes/(user)/explore/+page.svelte b/web/src/routes/(user)/explore/+page.svelte index 7c6424b5ac..591cb6876b 100644 --- a/web/src/routes/(user)/explore/+page.svelte +++ b/web/src/routes/(user)/explore/+page.svelte @@ -10,6 +10,7 @@ import EmptyPlaceholder from '$lib/components/shared-components/empty-placeholder.svelte'; import { onMount } from 'svelte'; import { websocketEvents } from '$lib/stores/websocket'; + import SingleGridRow from '$lib/components/shared-components/single-grid-row.svelte'; export let data: PageData; @@ -19,25 +20,14 @@ OBJECTS = 'smartInfo.objects', } - let MAX_PEOPLE_ITEMS: number; - let MAX_PLACE_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 || []; }; - $: places = getFieldItems(data.items, Field.CITY).slice(0, MAX_PLACE_ITEMS); - $: people = data.response.people.slice(0, MAX_PEOPLE_ITEMS); + $: places = getFieldItems(data.items, Field.CITY); + $: people = data.response.people; $: hasPeople = data.response.total > 0; - $: { - if (innerWidth && screenSize) { - // Set the number of faces according to the screen size and the div size - MAX_PEOPLE_ITEMS = screenSize < 768 ? Math.floor(innerWidth / 96) : Math.floor(innerWidth / 120); - MAX_PLACE_ITEMS = screenSize < 768 ? Math.floor(innerWidth / 150) : Math.floor(innerWidth / 172); - } - } onMount(() => { return websocketEvents.on('on_person_thumbnail', (personId: string) => { @@ -52,8 +42,6 @@ }); - - {#if hasPeople}
@@ -65,25 +53,17 @@ draggable="false">{$t('view_all')}
-
- {#if MAX_PEOPLE_ITEMS} - {#each people as person (person.id)} - - -

{person.name}

-
- {/each} - {/if} -
+ {#each people.slice(0, itemCount) as person (person.id)} + + +

{person.name}

+
+ {/each} +
{/if} @@ -97,16 +77,17 @@ draggable="false">{$t('view_all')}
-
- {#each places as item (item.data.id)} + + {#each places.slice(0, itemCount) as item (item.data.id)} -
+
{item.value}
{/each} -
+
{/if}