mirror of
https://github.com/immich-app/immich.git
synced 2025-12-09 21:13:45 +09:00
feat(web): toggle theme shortcut (#22139)
This commit is contained in:
@@ -1,11 +1,22 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { shortcut } from '$lib/actions/shortcut';
|
||||||
import { defaultLang, langs, Theme } from '$lib/constants';
|
import { defaultLang, langs, Theme } from '$lib/constants';
|
||||||
import { themeManager } from '$lib/managers/theme-manager.svelte';
|
import { themeManager } from '$lib/managers/theme-manager.svelte';
|
||||||
import { lang } from '$lib/stores/preferences.store';
|
import { lang } from '$lib/stores/preferences.store';
|
||||||
import { ThemeSwitcher } from '@immich/ui';
|
import { ThemeSwitcher } from '@immich/ui';
|
||||||
import { get } from 'svelte/store';
|
import { get } from 'svelte/store';
|
||||||
|
|
||||||
|
const handleToggleTheme = () => {
|
||||||
|
if (themeManager.theme.system) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
themeManager.toggleTheme();
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<svelte:window use:shortcut={{ shortcut: { key: 't', alt: true }, onShortcut: () => handleToggleTheme() }} />
|
||||||
|
|
||||||
{#if !themeManager.theme.system}
|
{#if !themeManager.theme.system}
|
||||||
{#await langs
|
{#await langs
|
||||||
.find((item) => item.code === get(lang))
|
.find((item) => item.code === get(lang))
|
||||||
|
|||||||
Reference in New Issue
Block a user