mirror of
https://github.com/immich-app/immich.git
synced 2025-12-12 16:37:55 -05:00
* First test * Added translation using Weblate (French) * Translated using Weblate (German) Currently translated at 100.0% (4 of 4 strings) Translation: immich/web Translate-URL: http://familie-mach.net/projects/immich/web/de/ * Translated using Weblate (French) Currently translated at 100.0% (4 of 4 strings) Translation: immich/web Translate-URL: http://familie-mach.net/projects/immich/web/fr/ * Further testing * Further testing * Translated using Weblate (German) Currently translated at 100.0% (18 of 18 strings) Translation: immich/web Translate-URL: http://familie-mach.net/projects/immich/web/de/ * Further work * Update string file. * More strings * Automatically changed strings * Add automatically translated german file for testing purposes * Fix merge-face-selector component * Make server stats strings uppercase * Fix uppercase string * Fix some strings in jobs-panel * Fix lower and uppercase strings. Add a few additional string. Fix a few unnecessary replacements * Update german test translations * Fix typo in locales file * Change string keys * Extract more strings * Extract and replace some more strings * Update testtranslationfile * Change translation keys * Fix rebase errors * Fix one more rebase error * Remove german translation file * Co-authored-by: Daniel Dietzler <danieldietzler@users.noreply.github.com> * chore: clean up translations * chore: add new line * fix formatting * chore: fixes * fix: loading and tests --------- Co-authored-by: root <root@Blacki> Co-authored-by: admin <admin@example.com> Co-authored-by: Jason Rasmussen <jrasm91@gmail.com> Co-authored-by: Daniel Dietzler <mail@ddietzler.dev>
106 lines
3.6 KiB
Svelte
106 lines
3.6 KiB
Svelte
<script lang="ts">
|
|
import Button from '$lib/components/elements/buttons/button.svelte';
|
|
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
|
import Icon from '$lib/components/elements/icon.svelte';
|
|
import FocusTrap from '$lib/components/shared-components/focus-trap.svelte';
|
|
import { AppRoute } from '$lib/constants';
|
|
import { preferences, user } from '$lib/stores/user.store';
|
|
import { handleError } from '$lib/utils/handle-error';
|
|
import { deleteProfileImage, updateMyPreferences, type UserAvatarColor } from '@immich/sdk';
|
|
import { mdiCog, mdiLogout, mdiPencil } from '@mdi/js';
|
|
import { createEventDispatcher } from 'svelte';
|
|
import { fade } from 'svelte/transition';
|
|
import { NotificationType, notificationController } from '../notification/notification';
|
|
import UserAvatar from '../user-avatar.svelte';
|
|
import AvatarSelector from './avatar-selector.svelte';
|
|
import { t } from 'svelte-i18n';
|
|
|
|
let isShowSelectAvatar = false;
|
|
|
|
const dispatch = createEventDispatcher<{
|
|
logout: void;
|
|
close: void;
|
|
}>();
|
|
|
|
const handleSaveProfile = async (color: UserAvatarColor) => {
|
|
try {
|
|
if ($user.profileImagePath !== '') {
|
|
await deleteProfileImage();
|
|
}
|
|
|
|
$preferences = await updateMyPreferences({ userPreferencesUpdateDto: { avatar: { color } } });
|
|
isShowSelectAvatar = false;
|
|
|
|
notificationController.show({
|
|
message: $t('saved_profile'),
|
|
type: NotificationType.Info,
|
|
});
|
|
} catch (error) {
|
|
handleError(error, $t('errors.unable_to_save_profile'));
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<FocusTrap>
|
|
<div
|
|
in:fade={{ duration: 100 }}
|
|
out:fade={{ duration: 100 }}
|
|
id="account-info-panel"
|
|
class="absolute right-[25px] top-[75px] z-[100] w-[360px] rounded-3xl bg-gray-200 shadow-lg dark:border dark:border-immich-dark-gray dark:bg-immich-dark-gray"
|
|
>
|
|
<div
|
|
class="mx-4 mt-4 flex flex-col items-center justify-center gap-4 rounded-3xl bg-white p-4 dark:bg-immich-dark-primary/10"
|
|
>
|
|
<div class="relative">
|
|
{#key $user}
|
|
<UserAvatar user={$user} size="xl" />
|
|
{/key}
|
|
<div class="absolute z-10 bottom-0 right-0 rounded-full w-6 h-6">
|
|
<CircleIconButton
|
|
color="primary"
|
|
icon={mdiPencil}
|
|
title={$t('edit_avatar')}
|
|
class="border"
|
|
size="12"
|
|
padding="2"
|
|
on:click={() => (isShowSelectAvatar = true)}
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<p class="text-center text-lg font-medium text-immich-primary dark:text-immich-dark-primary">
|
|
{$user.name}
|
|
</p>
|
|
<p class="text-sm text-gray-500 dark:text-immich-dark-fg">{$user.email}</p>
|
|
</div>
|
|
|
|
<a href={AppRoute.USER_SETTINGS} on:click={() => dispatch('close')}>
|
|
<Button color="dark-gray" size="sm" shadow={false} border>
|
|
<div class="flex place-content-center place-items-center gap-2 px-2">
|
|
<Icon path={mdiCog} size="18" />
|
|
Account Settings
|
|
</div>
|
|
</Button>
|
|
</a>
|
|
</div>
|
|
|
|
<div class="mb-4 flex flex-col">
|
|
<button
|
|
type="button"
|
|
class="flex w-full place-content-center place-items-center gap-2 py-3 font-medium text-gray-500 hover:bg-immich-primary/10 dark:text-gray-300"
|
|
on:click={() => dispatch('logout')}
|
|
>
|
|
<Icon path={mdiLogout} size={24} />
|
|
Sign Out</button
|
|
>
|
|
</div>
|
|
</div>
|
|
</FocusTrap>
|
|
{#if isShowSelectAvatar}
|
|
<AvatarSelector
|
|
user={$user}
|
|
on:close={() => (isShowSelectAvatar = false)}
|
|
on:choose={({ detail: color }) => handleSaveProfile(color)}
|
|
/>
|
|
{/if}
|