mirror of
https://github.com/samsonjs/immich.git
synced 2026-04-27 15:07:45 +00:00
refactor(web): user app settings (#25177)
This commit is contained in:
parent
e8c80d88a5
commit
d4ad523eb3
3 changed files with 64 additions and 94 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Combobox, { type ComboBoxOption } from '$lib/components/shared-components/combobox.svelte';
|
import Combobox, { type ComboBoxOption } from '$lib/components/shared-components/combobox.svelte';
|
||||||
|
import { Label, Text } from '@immich/ui';
|
||||||
import type { Snippet } from 'svelte';
|
import type { Snippet } from 'svelte';
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
import { quintOut } from 'svelte/easing';
|
import { quintOut } from 'svelte/easing';
|
||||||
|
|
@ -28,12 +29,9 @@
|
||||||
}: Props = $props();
|
}: Props = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="grid grid-cols-2">
|
<div>
|
||||||
<div>
|
|
||||||
<div class="flex h-6.5 place-items-center gap-1">
|
<div class="flex h-6.5 place-items-center gap-1">
|
||||||
<label class="font-medium text-primary text-sm" for={title}>
|
<Label>{title}</Label>
|
||||||
{title}
|
|
||||||
</label>
|
|
||||||
{#if isEdited}
|
{#if isEdited}
|
||||||
<div
|
<div
|
||||||
transition:fly={{ x: 10, duration: 200, easing: quintOut }}
|
transition:fly={{ x: 10, duration: 200, easing: quintOut }}
|
||||||
|
|
@ -44,9 +42,8 @@
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="text-sm dark:text-immich-dark-fg">{subtitle}</p>
|
<Text size="small" color="muted">{subtitle}</Text>
|
||||||
</div>
|
<div class="flex items-center mt-2 max-w-[300px]">
|
||||||
<div class="flex items-center">
|
|
||||||
<Combobox label={title} hideLabel={true} {selectedOption} {options} placeholder={comboboxPlaceholder} {onSelect} />
|
<Combobox label={title} hideLabel={true} {selectedOption} {options} placeholder={comboboxPlaceholder} {onSelect} />
|
||||||
{@render children?.()}
|
{@render children?.()}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
import { defaultLang, langs } from '$lib/constants';
|
import { defaultLang, langs } from '$lib/constants';
|
||||||
import { lang } from '$lib/stores/preferences.store';
|
import { lang } from '$lib/stores/preferences.store';
|
||||||
import { getClosestAvailableLocale, langCodes } from '$lib/utils/i18n';
|
import { getClosestAvailableLocale, langCodes } from '$lib/utils/i18n';
|
||||||
|
import { Label, Text } from '@immich/ui';
|
||||||
import { locale as i18nLocale, t } from 'svelte-i18n';
|
import { locale as i18nLocale, t } from 'svelte-i18n';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|
@ -34,16 +35,14 @@
|
||||||
let closestLanguage = $derived(getClosestAvailableLocale([$lang], langCodes));
|
let closestLanguage = $derived(getClosestAvailableLocale([$lang], langCodes));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class={showSettingDescription ? 'grid grid-cols-2' : ''}>
|
<div class="max-w-[300px]">
|
||||||
{#if showSettingDescription}
|
{#if showSettingDescription}
|
||||||
<div>
|
<div>
|
||||||
<div class="flex h-6.5 place-items-center gap-1">
|
<div class="flex h-6.5 place-items-center gap-1">
|
||||||
<label class="font-medium text-primary text-sm" for={$t('language')}>
|
<Label>{$t('language')}</Label>
|
||||||
{$t('language')}
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="text-sm dark:text-immich-dark-fg">{$t('language_setting_description')}</p>
|
<Text size="small" color="muted">{$t('language_setting_description')}</Text>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { ComboBoxOption } from '$lib/components/shared-components/combobox.svelte';
|
import type { ComboBoxOption } from '$lib/components/shared-components/combobox.svelte';
|
||||||
import SettingCombobox from '$lib/components/shared-components/settings/setting-combobox.svelte';
|
import SettingCombobox from '$lib/components/shared-components/settings/setting-combobox.svelte';
|
||||||
import SettingSwitch from '$lib/components/shared-components/settings/setting-switch.svelte';
|
|
||||||
import SettingsLanguageSelector from '$lib/components/shared-components/settings/settings-language-selector.svelte';
|
import SettingsLanguageSelector from '$lib/components/shared-components/settings/settings-language-selector.svelte';
|
||||||
import { fallbackLocale, locales } from '$lib/constants';
|
import { fallbackLocale, locales } from '$lib/constants';
|
||||||
import { themeManager } from '$lib/managers/theme-manager.svelte';
|
import { themeManager } from '$lib/managers/theme-manager.svelte';
|
||||||
|
|
@ -15,6 +14,7 @@
|
||||||
showDeleteModal,
|
showDeleteModal,
|
||||||
} from '$lib/stores/preferences.store';
|
} from '$lib/stores/preferences.store';
|
||||||
import { createDateFormatter, findLocale } from '$lib/utils';
|
import { createDateFormatter, findLocale } from '$lib/utils';
|
||||||
|
import { Field, Switch, Text } from '@immich/ui';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from 'svelte/transition';
|
||||||
|
|
@ -59,32 +59,19 @@
|
||||||
|
|
||||||
<section class="my-4">
|
<section class="my-4">
|
||||||
<div in:fade={{ duration: 500 }}>
|
<div in:fade={{ duration: 500 }}>
|
||||||
<div class="ms-4 mt-4 flex flex-col gap-4">
|
<div class="ms-8 mt-4 flex flex-col gap-4">
|
||||||
<div class="ms-4">
|
<Field label={$t('theme_selection')} description={$t('theme_selection_description')}>
|
||||||
<SettingSwitch
|
<Switch checked={themeManager.theme.system} onCheckedChange={(checked) => themeManager.setSystem(checked)} />
|
||||||
title={$t('theme_selection')}
|
</Field>
|
||||||
subtitle={$t('theme_selection_description')}
|
|
||||||
checked={themeManager.theme.system}
|
|
||||||
onToggle={(isChecked) => themeManager.setSystem(isChecked)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="ms-4">
|
|
||||||
<SettingsLanguageSelector showSettingDescription />
|
<SettingsLanguageSelector showSettingDescription />
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="ms-4">
|
<Field label={$t('default_locale')} description={$t('default_locale_description')}>
|
||||||
<SettingSwitch
|
<Switch checked={$locale == 'default'} onCheckedChange={handleToggleLocaleBrowser} />
|
||||||
title={$t('default_locale')}
|
<Text size="small" class="mt-2">{selectedDate}</Text>
|
||||||
subtitle={$t('default_locale_description')}
|
</Field>
|
||||||
checked={$locale == 'default'}
|
|
||||||
onToggle={handleToggleLocaleBrowser}
|
|
||||||
>
|
|
||||||
<p class="mt-2 dark:text-gray-400">{selectedDate}</p>
|
|
||||||
</SettingSwitch>
|
|
||||||
</div>
|
|
||||||
{#if $locale !== 'default'}
|
{#if $locale !== 'default'}
|
||||||
<div class="ms-4">
|
|
||||||
<SettingCombobox
|
<SettingCombobox
|
||||||
comboboxPlaceholder={$t('searching_locales')}
|
comboboxPlaceholder={$t('searching_locales')}
|
||||||
{selectedOption}
|
{selectedOption}
|
||||||
|
|
@ -93,47 +80,34 @@
|
||||||
subtitle={$t('custom_locale_description')}
|
subtitle={$t('custom_locale_description')}
|
||||||
onSelect={(combobox) => handleLocaleChange(combobox?.value)}
|
onSelect={(combobox) => handleLocaleChange(combobox?.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class="ms-4">
|
<Field label={$t('display_original_photos')} description={$t('display_original_photos_setting_description')}>
|
||||||
<SettingSwitch
|
<Switch bind:checked={$alwaysLoadOriginalFile} />
|
||||||
title={$t('display_original_photos')}
|
</Field>
|
||||||
subtitle={$t('display_original_photos_setting_description')}
|
|
||||||
bind:checked={$alwaysLoadOriginalFile}
|
<Field label={$t('video_hover_setting')} description={$t('video_hover_setting_description')}>
|
||||||
/>
|
<Switch bind:checked={$playVideoThumbnailOnHover} />
|
||||||
</div>
|
</Field>
|
||||||
<div class="ms-4">
|
|
||||||
<SettingSwitch
|
<Field
|
||||||
title={$t('video_hover_setting')}
|
label={$t('setting_video_viewer_auto_play_title')}
|
||||||
subtitle={$t('video_hover_setting_description')}
|
description={$t('setting_video_viewer_auto_play_subtitle')}
|
||||||
bind:checked={$playVideoThumbnailOnHover}
|
>
|
||||||
/>
|
<Switch bind:checked={$autoPlayVideo} />
|
||||||
</div>
|
</Field>
|
||||||
<div class="ms-4">
|
|
||||||
<SettingSwitch
|
<Field label={$t('loop_videos')} description={$t('loop_videos_description')}>
|
||||||
title={$t('setting_video_viewer_auto_play_title')}
|
<Switch bind:checked={$loopVideo} />
|
||||||
subtitle={$t('setting_video_viewer_auto_play_subtitle')}
|
</Field>
|
||||||
bind:checked={$autoPlayVideo}
|
|
||||||
/>
|
<Field label={$t('play_original_video')} description={$t('play_original_video_setting_description')}>
|
||||||
</div>
|
<Switch bind:checked={$alwaysLoadOriginalVideo} />
|
||||||
<div class="ms-4">
|
</Field>
|
||||||
<SettingSwitch title={$t('loop_videos')} subtitle={$t('loop_videos_description')} bind:checked={$loopVideo} />
|
|
||||||
</div>
|
<Field label={$t('permanent_deletion_warning')} description={$t('permanent_deletion_warning_setting_description')}
|
||||||
<div class="ms-4">
|
><Switch bind:checked={$showDeleteModal} />
|
||||||
<SettingSwitch
|
</Field>
|
||||||
title={$t('play_original_video')}
|
|
||||||
subtitle={$t('play_original_video_setting_description')}
|
|
||||||
bind:checked={$alwaysLoadOriginalVideo}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="ms-4">
|
|
||||||
<SettingSwitch
|
|
||||||
title={$t('permanent_deletion_warning')}
|
|
||||||
subtitle={$t('permanent_deletion_warning_setting_description')}
|
|
||||||
bind:checked={$showDeleteModal}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue