cleanup: switch to $state for themes

This commit is contained in:
James Xylight committed 2025-02-10 17:34:40 -08:00
1 parent a5ba6d66f6
commit 80df5c5409
19 files changed
+169 -349

No files matched your search

@@ -11,7 +11,7 @@
import { afterNavigate, goto } from '$app/navigation'
import { profile, profileData } from '$lib/auth.svelte'
import { getGroups, type Action, type Group } from './actions.svelte'
import { themeData } from '$lib/ui/colors'
import { theme } from '$lib/ui/colors.svelte'
import { page } from '$app/state'
interface Props {
@@ -26,7 +26,7 @@
$resumables,
profile.data,
profileData.profiles,
$themeData,
theme.data,
page.data.contextual?.actions,
)
})
@@ -8,7 +8,7 @@ import {
import { resumables, type ResumableItem } from '$lib/lemmy/item'
import { settings } from '$lib/settings.svelte'
import { t } from '$lib/translations'
import { colorScheme, theme, themeData, type ThemeData } from '$lib/ui/colors'
import { theme, type ThemeData } from '$lib/ui/colors.svelte'
import { fullCommunityName } from '$lib/util.svelte'
import {
ArrowRightOnRectangle,
@@ -357,21 +357,21 @@ export function getGroups(
name: t.get('nav.commands.setColorTo', {
default: t.get('nav.menu.colorscheme.system'),
}),
handle: () => colorScheme.set('system'),
handle: () => (theme.colorScheme = 'system'),
icon: ComputerDesktop,
},
{
name: t.get('nav.commands.setColorTo', {
default: t.get('nav.menu.colorscheme.light'),
}),
handle: () => colorScheme.set('light'),
handle: () => (theme.colorScheme = 'light'),
icon: Sun,
},
{
name: t.get('nav.commands.setColorTo', {
default: t.get('nav.menu.colorscheme.dark'),
}),
handle: () => colorScheme.set('dark'),
handle: () => (theme.colorScheme = 'dark'),
icon: Moon,
},
],
@@ -382,11 +382,7 @@ export function getGroups(
subActions: td.themes.map((th) => ({
name: t.get('nav.commands.setThemeTo', { default: th.name }),
icon: Swatch,
handle: () =>
themeData.update((td) => ({
...td,
currentTheme: th.id,
})),
handle: () => (theme.data.currentTheme = th.id),
})),
},
],