2023-05-17 13:07:17 -04:00
|
|
|
<script lang="ts">
|
2024-02-14 06:38:57 -08:00
|
|
|
import { type PersonResponseDto } from '@immich/sdk';
|
2024-04-17 09:15:37 +00:00
|
|
|
import { createEventDispatcher, onMount } from 'svelte';
|
2023-07-01 00:50:47 -04:00
|
|
|
import ImageThumbnail from '../assets/thumbnail/image-thumbnail.svelte';
|
|
|
|
|
import Button from '../elements/buttons/button.svelte';
|
2023-05-17 13:07:17 -04:00
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
export let person: PersonResponseDto;
|
2023-09-23 06:58:51 +02:00
|
|
|
export let name: string;
|
|
|
|
|
export let suggestedPeople = false;
|
2024-01-26 15:08:54 +01:00
|
|
|
export let thumbnailData: string;
|
2023-05-17 13:07:17 -04:00
|
|
|
|
2024-04-17 09:15:37 +00:00
|
|
|
let inputElement: HTMLInputElement;
|
|
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
const dispatch = createEventDispatcher<{
|
|
|
|
|
change: string;
|
|
|
|
|
cancel: void;
|
2023-10-24 17:53:49 +02:00
|
|
|
input: void;
|
2023-07-01 00:50:47 -04:00
|
|
|
}>();
|
2024-04-17 09:15:37 +00:00
|
|
|
|
|
|
|
|
onMount(() => {
|
|
|
|
|
inputElement.focus();
|
|
|
|
|
});
|
2023-05-17 13:07:17 -04:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<div
|
2023-10-24 17:53:49 +02:00
|
|
|
class="flex w-full h-14 place-items-center {suggestedPeople
|
|
|
|
|
? 'rounded-t-lg dark:border-immich-dark-gray'
|
2023-09-23 06:58:51 +02:00
|
|
|
: 'rounded-lg'} bg-gray-100 p-2 dark:bg-gray-700"
|
2023-05-17 13:07:17 -04:00
|
|
|
>
|
2024-01-26 15:08:54 +01:00
|
|
|
<ImageThumbnail circle shadow url={thumbnailData} altText={person.name} widthStyle="2rem" heightStyle="2rem" />
|
2023-07-01 00:50:47 -04:00
|
|
|
<form
|
2023-07-18 13:19:39 -05:00
|
|
|
class="ml-4 flex w-full justify-between gap-16"
|
2023-07-01 00:50:47 -04:00
|
|
|
autocomplete="off"
|
|
|
|
|
on:submit|preventDefault={() => dispatch('change', name)}
|
|
|
|
|
>
|
|
|
|
|
<input
|
2023-07-18 13:19:39 -05:00
|
|
|
class="w-full gap-2 bg-gray-100 dark:bg-gray-700 dark:text-white"
|
2023-07-01 00:50:47 -04:00
|
|
|
type="text"
|
|
|
|
|
placeholder="New name or nickname"
|
|
|
|
|
bind:value={name}
|
2024-04-17 09:15:37 +00:00
|
|
|
bind:this={inputElement}
|
2023-10-24 17:53:49 +02:00
|
|
|
on:input={() => dispatch('input')}
|
2023-07-01 00:50:47 -04:00
|
|
|
/>
|
|
|
|
|
<Button size="sm" type="submit">Done</Button>
|
|
|
|
|
</form>
|
2023-05-17 13:07:17 -04:00
|
|
|
</div>
|