|
@@ -5,6 +5,7 @@
|
|
import EditNameInput from '$lib/components/faces-page/edit-name-input.svelte';
|
|
import EditNameInput from '$lib/components/faces-page/edit-name-input.svelte';
|
|
import MergeFaceSelector from '$lib/components/faces-page/merge-face-selector.svelte';
|
|
import MergeFaceSelector from '$lib/components/faces-page/merge-face-selector.svelte';
|
|
import MergeSuggestionModal from '$lib/components/faces-page/merge-suggestion-modal.svelte';
|
|
import MergeSuggestionModal from '$lib/components/faces-page/merge-suggestion-modal.svelte';
|
|
|
|
+ import SetBirthDateModal from '$lib/components/faces-page/set-birth-date-modal.svelte';
|
|
import AddToAlbum from '$lib/components/photos-page/actions/add-to-album.svelte';
|
|
import AddToAlbum from '$lib/components/photos-page/actions/add-to-album.svelte';
|
|
import ArchiveAction from '$lib/components/photos-page/actions/archive-action.svelte';
|
|
import ArchiveAction from '$lib/components/photos-page/actions/archive-action.svelte';
|
|
import CreateSharedLink from '$lib/components/photos-page/actions/create-shared-link.svelte';
|
|
import CreateSharedLink from '$lib/components/photos-page/actions/create-shared-link.svelte';
|
|
@@ -39,6 +40,7 @@
|
|
SELECT_FACE = 'select-face',
|
|
SELECT_FACE = 'select-face',
|
|
MERGE_FACES = 'merge-faces',
|
|
MERGE_FACES = 'merge-faces',
|
|
SUGGEST_MERGE = 'suggest-merge',
|
|
SUGGEST_MERGE = 'suggest-merge',
|
|
|
|
+ BIRTH_DATE = 'birth-date',
|
|
}
|
|
}
|
|
|
|
|
|
const assetStore = new AssetStore({
|
|
const assetStore = new AssetStore({
|
|
@@ -172,6 +174,29 @@
|
|
}
|
|
}
|
|
changeName();
|
|
changeName();
|
|
};
|
|
};
|
|
|
|
+
|
|
|
|
+ const handleSetBirthDate = async (birthDate: string) => {
|
|
|
|
+ try {
|
|
|
|
+ viewMode = ViewMode.VIEW_ASSETS;
|
|
|
|
+ data.person.birthDate = birthDate;
|
|
|
|
+
|
|
|
|
+ const { data: updatedPerson } = await api.personApi.updatePerson({
|
|
|
|
+ id: data.person.id,
|
|
|
|
+ personUpdateDto: { birthDate: birthDate.length > 0 ? birthDate : null },
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ people = people.map((person: PersonResponseDto) => {
|
|
|
|
+ if (person.id === updatedPerson.id) {
|
|
|
|
+ return updatedPerson;
|
|
|
|
+ }
|
|
|
|
+ return person;
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ notificationController.show({ message: 'Date of birth saved successfully', type: NotificationType.Info });
|
|
|
|
+ } catch (error) {
|
|
|
|
+ handleError(error, 'Unable to save date of birth');
|
|
|
|
+ }
|
|
|
|
+ };
|
|
</script>
|
|
</script>
|
|
|
|
|
|
{#if viewMode === ViewMode.SUGGEST_MERGE}
|
|
{#if viewMode === ViewMode.SUGGEST_MERGE}
|
|
@@ -185,6 +210,14 @@
|
|
/>
|
|
/>
|
|
{/if}
|
|
{/if}
|
|
|
|
|
|
|
|
+{#if viewMode === ViewMode.BIRTH_DATE}
|
|
|
|
+ <SetBirthDateModal
|
|
|
|
+ birthDate={data.person.birthDate ?? ''}
|
|
|
|
+ on:close={() => (viewMode = ViewMode.VIEW_ASSETS)}
|
|
|
|
+ on:updated={(event) => handleSetBirthDate(event.detail)}
|
|
|
|
+ />
|
|
|
|
+{/if}
|
|
|
|
+
|
|
{#if viewMode === ViewMode.MERGE_FACES}
|
|
{#if viewMode === ViewMode.MERGE_FACES}
|
|
<MergeFaceSelector person={data.person} on:go-back={() => (viewMode = ViewMode.VIEW_ASSETS)} />
|
|
<MergeFaceSelector person={data.person} on:go-back={() => (viewMode = ViewMode.VIEW_ASSETS)} />
|
|
{/if}
|
|
{/if}
|
|
@@ -206,11 +239,12 @@
|
|
</AssetSelectContextMenu>
|
|
</AssetSelectContextMenu>
|
|
</AssetSelectControlBar>
|
|
</AssetSelectControlBar>
|
|
{:else}
|
|
{:else}
|
|
- {#if viewMode === ViewMode.VIEW_ASSETS || viewMode === ViewMode.SUGGEST_MERGE}
|
|
|
|
|
|
+ {#if viewMode === ViewMode.VIEW_ASSETS || viewMode === ViewMode.SUGGEST_MERGE || viewMode === ViewMode.BIRTH_DATE}
|
|
<ControlAppBar showBackButton backIcon={ArrowLeft} on:close-button-click={() => goto(previousRoute)}>
|
|
<ControlAppBar showBackButton backIcon={ArrowLeft} on:close-button-click={() => goto(previousRoute)}>
|
|
<svelte:fragment slot="trailing">
|
|
<svelte:fragment slot="trailing">
|
|
<AssetSelectContextMenu icon={DotsVertical} title="Menu">
|
|
<AssetSelectContextMenu icon={DotsVertical} title="Menu">
|
|
<MenuOption text="Change feature photo" on:click={() => (viewMode = ViewMode.SELECT_FACE)} />
|
|
<MenuOption text="Change feature photo" on:click={() => (viewMode = ViewMode.SELECT_FACE)} />
|
|
|
|
+ <MenuOption text="Set date of birth" on:click={() => (viewMode = ViewMode.BIRTH_DATE)} />
|
|
<MenuOption text="Merge face" on:click={() => (viewMode = ViewMode.MERGE_FACES)} />
|
|
<MenuOption text="Merge face" on:click={() => (viewMode = ViewMode.MERGE_FACES)} />
|
|
</AssetSelectContextMenu>
|
|
</AssetSelectContextMenu>
|
|
</svelte:fragment>
|
|
</svelte:fragment>
|
|
@@ -233,7 +267,7 @@
|
|
singleSelect={viewMode === ViewMode.SELECT_FACE}
|
|
singleSelect={viewMode === ViewMode.SELECT_FACE}
|
|
on:select={({ detail: asset }) => handleSelectFeaturePhoto(asset)}
|
|
on:select={({ detail: asset }) => handleSelectFeaturePhoto(asset)}
|
|
>
|
|
>
|
|
- {#if viewMode === ViewMode.VIEW_ASSETS || viewMode === ViewMode.SUGGEST_MERGE}
|
|
|
|
|
|
+ {#if viewMode === ViewMode.VIEW_ASSETS || viewMode === ViewMode.SUGGEST_MERGE || viewMode === ViewMode.BIRTH_DATE}
|
|
<!-- Face information block -->
|
|
<!-- Face information block -->
|
|
<section class="flex place-items-center p-4 sm:px-6">
|
|
<section class="flex place-items-center p-4 sm:px-6">
|
|
{#if isEditingName}
|
|
{#if isEditingName}
|