1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-27 22:22:45 +01:00
This commit is contained in:
thexeroxbe 2024-11-22 19:18:59 +01:00
parent 3a13307bb1
commit bebeec3e60
4 changed files with 16 additions and 10 deletions
web/src
lib/components
admin-page/settings
shared-components/settings
routes/auth/onboarding

View file

@ -10,7 +10,6 @@
import { onMount } from 'svelte';
import type { SettingsResetOptions } from './admin-settings';
import { t } from 'svelte-i18n';
import { retrieveThemeConfig } from '$lib/stores/theme-config.store';
interface Props {
config: SystemConfigDto;
@ -45,7 +44,6 @@
notificationController.show({ message: $t('settings_saved'), type: NotificationType.Info });
await retrieveServerConfig();
await retrieveThemeConfig();
} catch (error) {
handleError(error, $t('errors.unable_to_save_settings'));
}

View file

@ -46,6 +46,10 @@
root.style.setProperty(cssTag, hexToRgb(color));
}
};
const setThemeColor = (color: string, key: ThemeColorKeys, theme: ThemeKeys) => {
config.theme.themes[theme][key] = color;
};
</script>
<div>
@ -71,18 +75,24 @@
<SettingsColorpicker
{disabled}
label={$t(`admin.theme_${key}_color`, { values: { theme: theme } })}
bind:value={config.theme.themes[theme][key]}
value={config.theme.themes[theme][key]}
required={true}
isEdited={config.theme.themes[theme][key] !== savedConfig.theme.themes[theme][key]}
onChange={(color) =>
colorLivePreview(color, theme === 'light' ? `--immich-${key}` : `--immich-${theme}-${key}`)}
onChange={(color) => {
colorLivePreview(color, theme === 'light' ? `--immich-${key}` : `--immich-${theme}-${key}`);
setThemeColor(color, key, theme);
}}
/>
{/each}</SettingAccordion
>{/each}
{config.theme.themes.light.primary}
<SettingButtonsRow
onReset={(options) => onReset({ ...options, configKeys: ['theme'] })}
onSave={() => onSave({ theme: config.theme })}
onSave={() => {
onSave({ theme: { customCss: config.theme.customCss, themes: config.theme.themes } });
}}
showResetToDefault={!isEqual(savedConfig, defaultConfig)}
{disabled}
/>

View file

@ -27,8 +27,8 @@
}: Props = $props();
const handleInput = (e: Event) => {
value = (e.target as HTMLInputElement).value;
onChange!(value);
let _value = (e.target as HTMLInputElement).value;
onChange!(_value);
};
</script>

View file

@ -10,7 +10,6 @@
import { AppRoute, QueryParameter } from '$lib/constants';
import { retrieveServerConfig } from '$lib/stores/server-config.store';
import { updateAdminOnboarding } from '@immich/sdk';
import { retrieveThemeConfig } from '$lib/stores/theme-config.store';
let index = $state(0);
@ -40,7 +39,6 @@
if (index >= onboardingSteps.length - 1) {
await updateAdminOnboarding({ adminOnboardingUpdateDto: { isOnboarded: true } });
await retrieveServerConfig();
await retrieveThemeConfig();
await goto(AppRoute.PHOTOS);
} else {
index++;