diff --git a/src/lib/components/navbar.svelte b/src/lib/components/navbar.svelte index 992a51c62..97d6d6f6c 100644 --- a/src/lib/components/navbar.svelte +++ b/src/lib/components/navbar.svelte @@ -7,9 +7,10 @@ Tooltip, Card, ActionMenu, - Input, + ToggleButton, Button, - Avatar + Avatar, + Typography } from '@appwrite.io/pink-svelte'; import { toggleCommandCenter } from '$lib/commandCenter/commandCenter.svelte'; import type { BaseNavbarProps } from '@appwrite.io/pink-svelte/dist/navbar/Base.svelte'; @@ -32,6 +33,7 @@ import { app } from '$lib/stores/app'; import { isTabletViewport } from '$lib/stores/viewport'; import { isCloud } from '$lib/system.js'; + import { user } from '$lib/stores/user'; let showSupport = false; @@ -76,6 +78,11 @@ export let sideBarIsOpen: $$Props['sideBarIsOpen'] = false; export let showAccountMenu = false; + let activeTheme = 'dark'; + + $: { + updateTheme(activeTheme); + } $: currentOrg = organizations.find((org) => org.isSelected); @@ -157,30 +164,41 @@ +
+ + {$user.email} + +
Account Sign out
- { - updateTheme(event.detail); - }} - bind:group={$app.theme} - options={[ - { label: 'Light', value: 'light', leadingIcon: IconSun }, - { label: 'Dark', value: 'dark', leadingIcon: IconMoon }, - { label: 'System', value: 'system', leadingIcon: IconMode } - ]} /> +
+ + Theme + + +
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index aed7d0b35..d30b88fa4 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -90,19 +90,29 @@ $: { if (browser) { const isCloudClass = isCloud ? 'is-cloud' : ''; + if ($app.theme === 'auto') { const darkThemeMq = window.matchMedia('(prefers-color-scheme: dark)'); if (darkThemeMq.matches) { - document.body.setAttribute('class', `theme-dark ${isCloudClass}`); + document.body.setAttribute('class', `theme-dark ${isCloudClass} no-transition`); $app.themeInUse = 'dark'; } else { - document.body.setAttribute('class', `theme-light ${isCloudClass}`); + document.body.setAttribute( + 'class', + `theme-light ${isCloudClass} no-transition` + ); $app.themeInUse = 'light'; } } else { - document.body.setAttribute('class', `theme-${$app.theme} ${isCloudClass}`); + document.body.setAttribute( + 'class', + `theme-${$app.theme} ${isCloudClass} no-transition` + ); $app.themeInUse = $app.theme; } + requestAnimationFrame(() => { + document.body.classList.remove('no-transition'); + }); } } @@ -123,6 +133,12 @@