pr feedback
This commit is contained in:
@@ -21,7 +21,7 @@
|
|||||||
import { linear } from 'svelte/easing';
|
import { linear } from 'svelte/easing';
|
||||||
import { fly } from 'svelte/transition';
|
import { fly } from 'svelte/transition';
|
||||||
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
||||||
import type { FaceWithGeneretedThumbnail } from '$lib/utils/people-utils';
|
import type { FaceWithGeneratedThumbnail } from '$lib/utils/people-utils';
|
||||||
import {
|
import {
|
||||||
NotificationType,
|
NotificationType,
|
||||||
notificationController,
|
notificationController,
|
||||||
@@ -45,11 +45,11 @@
|
|||||||
let peopleWithFaces: AssetFaceResponseDto[] = [];
|
let peopleWithFaces: AssetFaceResponseDto[] = [];
|
||||||
let selectedPersonToReassign: Record<string, PersonResponseDto> = {};
|
let selectedPersonToReassign: Record<string, PersonResponseDto> = {};
|
||||||
let selectedPersonToCreate: Record<string, string> = {};
|
let selectedPersonToCreate: Record<string, string> = {};
|
||||||
let selectedPersonToAdd: Record<string, FaceWithGeneretedThumbnail> = {};
|
let selectedPersonToAdd: Record<string, FaceWithGeneratedThumbnail> = {};
|
||||||
let selectedFaceToRemove: Record<string, AssetFaceResponseDto> = {};
|
let selectedFaceToRemove: Record<string, AssetFaceResponseDto> = {};
|
||||||
let editedPerson: PersonResponseDto;
|
let editedPerson: PersonResponseDto;
|
||||||
let editedFace: AssetFaceResponseDto;
|
let editedFace: AssetFaceResponseDto;
|
||||||
let unassignedFaces: FaceWithGeneretedThumbnail[] = [];
|
let unassignedFaces: FaceWithGeneratedThumbnail[] = [];
|
||||||
|
|
||||||
// loading spinners
|
// loading spinners
|
||||||
let isShowLoadingDone = false;
|
let isShowLoadingDone = false;
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
unassignedFaces = peopleWithGeneratedImage.filter((item): item is FaceWithGeneretedThumbnail => item !== undefined);
|
unassignedFaces = peopleWithGeneratedImage.filter((item): item is FaceWithGeneratedThumbnail => item !== undefined);
|
||||||
};
|
};
|
||||||
|
|
||||||
async function loadPeople() {
|
async function loadPeople() {
|
||||||
@@ -225,7 +225,7 @@
|
|||||||
showSelectedFaces = true;
|
showSelectedFaces = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleCreateOrReassignFaceFromUnassignedFace = (face: FaceWithGeneretedThumbnail) => {
|
const handleCreateOrReassignFaceFromUnassignedFace = (face: FaceWithGeneratedThumbnail) => {
|
||||||
selectedPersonToAdd[face.id] = face;
|
selectedPersonToAdd[face.id] = face;
|
||||||
selectedPersonToAdd = selectedPersonToAdd;
|
selectedPersonToAdd = selectedPersonToAdd;
|
||||||
showUnassignedFaces = false;
|
showUnassignedFaces = false;
|
||||||
@@ -234,7 +234,7 @@
|
|||||||
const handleOpenAvailableFaces = () => {
|
const handleOpenAvailableFaces = () => {
|
||||||
showUnassignedFaces = !showUnassignedFaces;
|
showUnassignedFaces = !showUnassignedFaces;
|
||||||
};
|
};
|
||||||
const handleRemoveAddedFace = (face: FaceWithGeneretedThumbnail) => {
|
const handleRemoveAddedFace = (face: FaceWithGeneratedThumbnail) => {
|
||||||
$boundingBoxesArray = [];
|
$boundingBoxesArray = [];
|
||||||
delete selectedPersonToAdd[face.id];
|
delete selectedPersonToAdd[face.id];
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { fly } from 'svelte/transition';
|
import { fly } from 'svelte/transition';
|
||||||
import { linear } from 'svelte/easing';
|
import { linear } from 'svelte/easing';
|
||||||
import { mdiAccountOff, mdiArrowLeftThin, mdiClose, mdiMinus } from '@mdi/js';
|
import { mdiAccountOff, mdiArrowLeftThin, mdiClose, mdiMinus } from '@mdi/js';
|
||||||
import type { FaceWithGeneretedThumbnail } from '$lib/utils/people-utils';
|
import type { FaceWithGeneratedThumbnail } from '$lib/utils/people-utils';
|
||||||
import { boundingBoxesArray } from '$lib/stores/people.store';
|
import { boundingBoxesArray } from '$lib/stores/people.store';
|
||||||
import type { AssetFaceResponseDto, AssetTypeEnum, PersonResponseDto } from '@immich/sdk';
|
import type { AssetFaceResponseDto, AssetTypeEnum, PersonResponseDto } from '@immich/sdk';
|
||||||
import ImageThumbnail from '$lib/components/assets/thumbnail/image-thumbnail.svelte';
|
import ImageThumbnail from '$lib/components/assets/thumbnail/image-thumbnail.svelte';
|
||||||
@@ -11,28 +11,28 @@
|
|||||||
import { getPeopleThumbnailUrl } from '$lib/utils';
|
import { getPeopleThumbnailUrl } from '$lib/utils';
|
||||||
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
||||||
|
|
||||||
export let unassignedFaces: FaceWithGeneretedThumbnail[];
|
export let unassignedFaces: FaceWithGeneratedThumbnail[];
|
||||||
export let allPeople: PersonResponseDto[];
|
export let allPeople: PersonResponseDto[];
|
||||||
export let selectedPersonToAdd: Record<string, FaceWithGeneretedThumbnail>;
|
export let selectedPersonToAdd: Record<string, FaceWithGeneratedThumbnail>;
|
||||||
export let selectedFaceToRemove: Record<string, AssetFaceResponseDto>;
|
export let selectedFaceToRemove: Record<string, AssetFaceResponseDto>;
|
||||||
export let assetType: AssetTypeEnum;
|
export let assetType: AssetTypeEnum;
|
||||||
export let assetId: string;
|
export let assetId: string;
|
||||||
export let onResetFacesToBeRemoved = () => {};
|
export let onResetFacesToBeRemoved = () => {};
|
||||||
export let onClose = () => {};
|
export let onClose = () => {};
|
||||||
export let onCreatePerson: (face: FaceWithGeneretedThumbnail) => void;
|
export let onCreatePerson: (face: FaceWithGeneratedThumbnail) => void;
|
||||||
export let onReassign: (face: FaceWithGeneretedThumbnail) => void;
|
export let onReassign: (face: FaceWithGeneratedThumbnail) => void;
|
||||||
export let onAbortRemove: (id: string) => void;
|
export let onAbortRemove: (id: string) => void;
|
||||||
|
|
||||||
let showSeletecFaces = false;
|
let showSelectedFaces = false;
|
||||||
let editedFace: FaceWithGeneretedThumbnail;
|
let editedFace: FaceWithGeneratedThumbnail;
|
||||||
|
|
||||||
const handleSelectedFace = (face: FaceWithGeneretedThumbnail) => {
|
const handleSelectedFace = (face: FaceWithGeneratedThumbnail) => {
|
||||||
editedFace = face;
|
editedFace = face;
|
||||||
showSeletecFaces = true;
|
showSelectedFaces = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCreatePerson = (newFeaturePhoto: string | null) => {
|
const handleCreatePerson = (newFeaturePhoto: string | null) => {
|
||||||
showSeletecFaces = false;
|
showSelectedFaces = false;
|
||||||
if (newFeaturePhoto) {
|
if (newFeaturePhoto) {
|
||||||
editedFace.customThumbnail = newFeaturePhoto;
|
editedFace.customThumbnail = newFeaturePhoto;
|
||||||
onCreatePerson(editedFace);
|
onCreatePerson(editedFace);
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
const handleReassignFace = (person: PersonResponseDto | null) => {
|
const handleReassignFace = (person: PersonResponseDto | null) => {
|
||||||
if (person) {
|
if (person) {
|
||||||
showSeletecFaces = false;
|
showSelectedFaces = false;
|
||||||
editedFace.person = person;
|
editedFace.person = person;
|
||||||
onReassign(editedFace);
|
onReassign(editedFace);
|
||||||
} else {
|
} else {
|
||||||
@@ -95,8 +95,8 @@
|
|||||||
<button
|
<button
|
||||||
tabindex={index}
|
tabindex={index}
|
||||||
class="absolute left-0 top-0 h-[90px] w-[90px] cursor-default"
|
class="absolute left-0 top-0 h-[90px] w-[90px] cursor-default"
|
||||||
on:focus={() => (face ? ($boundingBoxesArray = [face]) : '')}
|
on:focus={() => ($boundingBoxesArray = [face])}
|
||||||
on:mouseover={() => (face ? ($boundingBoxesArray = [face]) : '')}
|
on:mouseover={() => ($boundingBoxesArray = [face])}
|
||||||
on:mouseleave={() => ($boundingBoxesArray = [])}
|
on:mouseleave={() => ($boundingBoxesArray = [])}
|
||||||
>
|
>
|
||||||
<ImageThumbnail
|
<ImageThumbnail
|
||||||
@@ -191,13 +191,13 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{#if showSeletecFaces}
|
{#if showSelectedFaces}
|
||||||
<AssignFaceSidePanel
|
<AssignFaceSidePanel
|
||||||
{assetType}
|
{assetType}
|
||||||
{assetId}
|
{assetId}
|
||||||
{editedFace}
|
{editedFace}
|
||||||
{allPeople}
|
{allPeople}
|
||||||
onClose={() => (showSeletecFaces = false)}
|
onClose={() => (showSelectedFaces = false)}
|
||||||
onCreatePerson={handleCreatePerson}
|
onCreatePerson={handleCreatePerson}
|
||||||
onReassign={handleReassignFace}
|
onReassign={handleReassignFace}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -152,10 +152,10 @@
|
|||||||
disabled={disableButtons || hasSelection}
|
disabled={disableButtons || hasSelection}
|
||||||
on:click={handleUnassign}
|
on:click={handleUnassign}
|
||||||
>
|
>
|
||||||
{#if !showLoadingSpinnerUnassign}
|
{#if showLoadingSpinnerUnassign}
|
||||||
<Icon path={mdiTagRemove} size={18} />
|
|
||||||
{:else}
|
|
||||||
<LoadingSpinner />
|
<LoadingSpinner />
|
||||||
|
{:else}
|
||||||
|
<Icon path={mdiTagRemove} size={18} />
|
||||||
{/if}
|
{/if}
|
||||||
<span class="ml-2"> Unassign</span></Button
|
<span class="ml-2"> Unassign</span></Button
|
||||||
>
|
>
|
||||||
@@ -165,10 +165,10 @@
|
|||||||
disabled={disableButtons || hasSelection}
|
disabled={disableButtons || hasSelection}
|
||||||
on:click={handleCreate}
|
on:click={handleCreate}
|
||||||
>
|
>
|
||||||
{#if !showLoadingSpinnerCreate}
|
{#if showLoadingSpinnerCreate}
|
||||||
<Icon path={mdiPlus} size={18} />
|
|
||||||
{:else}
|
|
||||||
<LoadingSpinner />
|
<LoadingSpinner />
|
||||||
|
{:else}
|
||||||
|
<Icon path={mdiPlus} size={18} />
|
||||||
{/if}
|
{/if}
|
||||||
<span class="ml-2"> Create new Person</span></Button
|
<span class="ml-2"> Create new Person</span></Button
|
||||||
>
|
>
|
||||||
@@ -178,12 +178,12 @@
|
|||||||
disabled={disableButtons || !hasSelection}
|
disabled={disableButtons || !hasSelection}
|
||||||
on:click={handleReassign}
|
on:click={handleReassign}
|
||||||
>
|
>
|
||||||
{#if !showLoadingSpinnerReassign}
|
{#if showLoadingSpinnerReassign}
|
||||||
|
<LoadingSpinner />
|
||||||
|
{:else}
|
||||||
<div>
|
<div>
|
||||||
<Icon path={mdiMerge} size={18} class="rotate-180" />
|
<Icon path={mdiMerge} size={18} class="rotate-180" />
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
|
||||||
<LoadingSpinner />
|
|
||||||
{/if}
|
{/if}
|
||||||
<span class="ml-2"> Reassign</span></Button
|
<span class="ml-2"> Reassign</span></Button
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export interface boundingBox {
|
|||||||
height: number;
|
height: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FaceWithGeneretedThumbnail extends AssetFaceResponseDto {
|
export interface FaceWithGeneratedThumbnail extends AssetFaceResponseDto {
|
||||||
customThumbnail: string;
|
customThumbnail: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user