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 <[email protected]>

* 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 <[email protected]>

---------

Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: Rotimi Best <[email protected]>
This commit is contained in:
Rotimi Best
2026-07-12 17:52:23 +01:00
committed by GitHub
co-authored by Rotimi Best Cursor Agent
parent 46feccd0fd
commit 877b45b1a3
8 changed files with 112 additions and 80 deletions
+2 -10
View File
@@ -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} />