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:
parent
4a0052026f
commit
b776461297
2 changed files with 9 additions and 5 deletions
|
@ -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>
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue