1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-04 02:46:47 +01:00

fix(web): grid on people page (#5640)

* fix: grid on people page

* pr feedback

* wait before width is set

* fix: animation

* fix: use grid instead

---------

Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
martin 2024-01-09 04:04:38 +01:00 committed by GitHub
parent bf8e2966c4
commit 29b204de57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 40 deletions

View file

@ -46,7 +46,7 @@
role="group" role="group"
> >
<a href="{AppRoute.PEOPLE}/{person.id}?previousRoute={AppRoute.PEOPLE}" draggable="false"> <a href="{AppRoute.PEOPLE}/{person.id}?previousRoute={AppRoute.PEOPLE}" draggable="false">
<div class="h-48 w-48 rounded-xl brightness-95 filter"> <div class="w-full h-full rounded-xl brightness-95 filter">
<ImageThumbnail <ImageThumbnail
shadow shadow
{preload} {preload}

View file

@ -16,10 +16,11 @@
export let showLoadingSpinner: boolean; export let showLoadingSpinner: boolean;
export let toggleVisibility: boolean; export let toggleVisibility: boolean;
export let screenHeight: number;
</script> </script>
<section <section
transition:fly={{ y: 500, duration: 100, easing: quintOut }} transition:fly={{ y: screenHeight, duration: 150, easing: quintOut, opacity: 1 }}
class="absolute left-0 top-0 z-[9999] h-full w-full bg-immich-bg dark:bg-immich-dark-bg" class="absolute left-0 top-0 z-[9999] h-full w-full bg-immich-bg dark:bg-immich-dark-bg"
> >
<div <div

View file

@ -45,6 +45,8 @@
let potentialMergePeople: PersonResponseDto[] = []; let potentialMergePeople: PersonResponseDto[] = [];
let edittingPerson: PersonResponseDto | null = null; let edittingPerson: PersonResponseDto | null = null;
let innerHeight: number;
people.forEach((person: PersonResponseDto) => { people.forEach((person: PersonResponseDto) => {
initialHiddenValues[person.id] = person.isHidden; initialHiddenValues[person.id] = person.isHidden;
}); });
@ -344,6 +346,8 @@
}; };
</script> </script>
<svelte:window bind:innerHeight />
{#if showMergeModal} {#if showMergeModal}
<FullScreenModal on:clickOutside={() => (showMergeModal = false)}> <FullScreenModal on:clickOutside={() => (showMergeModal = false)}>
<MergeSuggestionModal <MergeSuggestionModal
@ -370,21 +374,19 @@
</svelte:fragment> </svelte:fragment>
{#if countVisiblePeople > 0} {#if countVisiblePeople > 0}
<div class="pl-4"> <div class="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 xl:grid-cols-7 2xl:grid-cols-9 gap-1">
<div class="flex flex-row flex-wrap gap-1"> {#each people as person, idx (person.id)}
{#each people as person, idx (person.id)} {#if !person.isHidden}
{#if !person.isHidden} <PeopleCard
<PeopleCard {person}
{person} preload={idx < 20}
preload={idx < 20} on:change-name={() => handleChangeName(person)}
on:change-name={() => handleChangeName(person)} on:set-birth-date={() => handleSetBirthDate(person)}
on:set-birth-date={() => handleSetBirthDate(person)} on:merge-people={() => handleMergePeople(person)}
on:merge-people={() => handleMergePeople(person)} on:hide-person={() => handleHidePerson(person)}
on:hide-person={() => handleHidePerson(person)} />
/> {/if}
{/if} {/each}
{/each}
</div>
</div> </div>
{:else} {:else}
<div class="flex min-h-[calc(66vh_-_11rem)] w-full place-content-center items-center dark:text-white"> <div class="flex min-h-[calc(66vh_-_11rem)] w-full place-content-center items-center dark:text-white">
@ -444,29 +446,32 @@
on:change={handleToggleVisibility} on:change={handleToggleVisibility}
bind:showLoadingSpinner bind:showLoadingSpinner
bind:toggleVisibility bind:toggleVisibility
screenHeight={innerHeight}
> >
{#each people as person, idx (person.id)} <div class="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 xl:grid-cols-7 2xl:grid-cols-9 gap-1">
<button {#each people as person, idx (person.id)}
class="relative h-36 w-36 md:h-48 md:w-48" <button
on:click={() => (person.isHidden = !person.isHidden)} class="relative"
on:mouseenter={() => (eyeColorMap[person.id] = 'black')} on:click={() => (person.isHidden = !person.isHidden)}
on:mouseleave={() => (eyeColorMap[person.id] = 'white')} on:mouseenter={() => (eyeColorMap[person.id] = 'black')}
> on:mouseleave={() => (eyeColorMap[person.id] = 'white')}
<ImageThumbnail >
preload={idx < 20} <ImageThumbnail
bind:hidden={person.isHidden} preload={idx < 20}
shadow bind:hidden={person.isHidden}
url={api.getPeopleThumbnailUrl(person.id)} shadow
altText={person.name} url={api.getPeopleThumbnailUrl(person.id)}
widthStyle="100%" altText={person.name}
bind:eyeColor={eyeColorMap[person.id]} widthStyle="100%"
/> bind:eyeColor={eyeColorMap[person.id]}
{#if person.name} />
<span class="absolute bottom-2 left-0 w-full select-text px-1 text-center font-medium text-white"> {#if person.name}
{person.name} <span class="absolute bottom-2 left-0 w-full select-text px-1 text-center font-medium text-white">
</span> {person.name}
{/if} </span>
</button> {/if}
{/each} </button>
{/each}
</div>
</ShowHide> </ShowHide>
{/if} {/if}