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

View file

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