fix(dashboard): honor sidebar theme preference on all routes (#738)
* fix(dashboard): honor sidebar theme preference on all routes Stop forcing light mode on public org-site pages. Use one ModeWatcher everywhere so light/dark/system follows the sidebar footer toggle. - Remove isPublicOrgSitePage forced-light routing (#716 behavior) - Fix theme toggle active state (light/dark/system mutually exclusive) Co-authored-by: Rotimi Best <rotimi-best@users.noreply.github.com> * fix(dashboard): apply sidebar color mode instead of browser default ModeWatcher defaulted to system, so prefers-color-scheme won unless localStorage happened to match. AppModeWatcher now: - Defaults new visitors to light (not system) - Injects FOUC script with the same default - Only tracks OS appearance when the user picks System in the sidebar - Re-syncs explicit light/dark from mode-watcher localStorage on load Co-authored-by: Rotimi Best <rotimi-best@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Rotimi Best <rotimi-best@users.noreply.github.com>
This commit is contained in:
co-authored by
Rotimi Best
Cursor Agent
parent
46feccd0fd
commit
877b45b1a3
@@ -14,9 +14,8 @@
|
||||
import { authClient } from '$lib/utils/services/auth/client';
|
||||
import merge from 'lodash/merge';
|
||||
import { MetaTags } from 'svelte-meta-tags';
|
||||
import { ModeWatcher } from '@cio/ui/base/dark-mode';
|
||||
import AppModeWatcher from '$features/app/app-mode-watcher.svelte';
|
||||
import OrgSiteFavicon from '$features/app/org-site-favicon.svelte';
|
||||
import { isPublicOrgSitePage } from '$lib/utils/functions/color-scheme';
|
||||
|
||||
import '../app.css';
|
||||
|
||||
@@ -27,7 +26,6 @@
|
||||
setUploadLimitsContext(data.uploadLimits);
|
||||
|
||||
const metaTags = $derived(merge(data.baseMetaTags, page.data.pageMetaTags));
|
||||
const forceLightMode = $derived(isPublicOrgSitePage(data.isOrgSite, page.url.pathname));
|
||||
|
||||
onMount(() => {
|
||||
console.log('Layout', data);
|
||||
@@ -105,13 +103,7 @@
|
||||
</svelte:head>
|
||||
|
||||
<div>
|
||||
{#key forceLightMode}
|
||||
{#if forceLightMode}
|
||||
<ModeWatcher defaultMode="light" track={false} />
|
||||
{:else}
|
||||
<ModeWatcher />
|
||||
{/if}
|
||||
{/key}
|
||||
<AppModeWatcher />
|
||||
|
||||
<MetaTags {...metaTags} />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user