1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-01 08:31:59 +00:00

fix(web): unable to change person name (#2458)

* fix(web): unable to change person name

* name changed

* chore: strongly-typed dispatcher

---------

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
Alex 2023-05-17 21:13:54 -05:00 committed by GitHub
parent 4a0052026f
commit b776461297
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View file

@ -3,16 +3,21 @@
import { createEventDispatcher } from 'svelte';
import ImageThumbnail from '../assets/thumbnail/image-thumbnail.svelte';
import Button from '../elements/buttons/button.svelte';
import { clickOutside } from '$lib/utils/click-outside';
export let person: PersonResponseDto;
let name = person.name;
const dispatch = createEventDispatcher<{ change: string }>();
const handleNameChange = () => dispatch('change', name);
const dispatch = createEventDispatcher<{
change: string;
cancel: void;
}>();
</script>
<div
class="flex place-items-center max-w-lg rounded-lg border dark:border-transparent p-2 bg-gray-100 dark:bg-gray-700"
use:clickOutside
on:outclick={() => dispatch('cancel')}
>
<ImageThumbnail
circle
@ -25,7 +30,7 @@
<form
class="ml-4 flex justify-between w-full gap-16"
autocomplete="off"
on:submit|preventDefault={handleNameChange}
on:submit|preventDefault={() => dispatch('change', name)}
>
<!-- svelte-ignore a11y-autofocus -->
<input
@ -35,7 +40,6 @@
placeholder="New name or nickname"
required
bind:value={name}
on:blur
/>
<Button size="sm" type="submit">Done</Button>
</form>

View file

@ -70,7 +70,7 @@
<EditNameInput
person={data.person}
on:change={(event) => handleNameChange(event.detail)}
on:blur={() => (isEditName = false)}
on:cancel={() => (isEditName = false)}
/>
{:else}
<ImageThumbnail