feat: theme toggle - #8128
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe change centralises dark-mode state in Estimated code review effort: 3 (Moderate) | ~20 minutes Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: af7fdd78-7bf8-470b-8b44-c1b62131a8a1
📒 Files selected for processing (8)
frontend/documentation/components/ThemeToggle.stories.tsxfrontend/web/components/DarkModeSwitch.tsxfrontend/web/components/ThemeToggle/ThemeToggle.tsxfrontend/web/components/ThemeToggle/index.tsfrontend/web/components/navigation/navbars/TopNavbar.tsxfrontend/web/components/pages/onboarding/OnboardingFlow/OnboardingFlow.tsxfrontend/web/components/pages/onboarding/ThemeToggle/ThemeToggle.tsxfrontend/web/project/darkMode.ts
💤 Files with no reviewable changes (1)
- frontend/web/components/pages/onboarding/ThemeToggle/ThemeToggle.tsx
darkMode.ts becomes a small reactive theme store: light/dark/system (system follows prefers-color-scheme), legacy dark_mode storage migrates, and a storage listener updates already-open tabs. The onboarding ThemeToggle is promoted to components/ThemeToggle and gains a labelled Light/Dark/System menu (the icon set has no system glyph, so a menu beats a blind three-state cycle). The account-settings switch shares the same store so neither control goes stale. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Drops the Light/Dark/System menu: the OS preference decides the theme until the user makes an explicit choice, and the nav control is a plain sun/moon flip like onboarding's. Deviates from #7702's second criterion as written (no selectable system option); flagged on the PR for the issue author. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
8bd312a to
a7e78ba
Compare
Docker builds report
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 6756fa97-636b-4bd8-82fe-84d3876752f9
📒 Files selected for processing (8)
frontend/documentation/components/ThemeToggle.stories.tsxfrontend/web/components/DarkModeSwitch.tsxfrontend/web/components/ThemeToggle/ThemeToggle.tsxfrontend/web/components/ThemeToggle/index.tsfrontend/web/components/navigation/navbars/TopNavbar.tsxfrontend/web/components/pages/onboarding/OnboardingFlow/OnboardingFlow.tsxfrontend/web/components/pages/onboarding/ThemeToggle/ThemeToggle.tsxfrontend/web/project/darkMode.ts
💤 Files with no reviewable changes (1)
- frontend/web/components/pages/onboarding/ThemeToggle/ThemeToggle.tsx
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #18954 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
🗂️ Previous results✅ private-cloud · depot-ubuntu-latest-16 — run #18954 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
✅ oss · depot-ubuntu-latest-arm-16 — run #18954 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
✅ oss · depot-ubuntu-latest-16 — run #18954 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-16)Details
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #18920 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
✅ private-cloud · depot-ubuntu-latest-16 — run #18920 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
✅ oss · depot-ubuntu-latest-16 — run #18920 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-16)Details
✅ oss · depot-ubuntu-latest-arm-16 — run #18920 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
|
Visual Regression19 screenshots compared. See report for details. |
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
Contributes to #7702
Adds a one-click light/dark toggle to the top bar, behind the
dark_mode_nav_toggleflag (created, default off).darkMode.tsbecomes a small reactive theme store. With no stored choice the theme follows the OS (prefers-color-scheme, live); the first explicit choice pins it. Legacydark_modestorage migrates.storagelistener.ThemeToggleis promoted tocomponents/ThemeToggle; onboarding reuses it. The Account Settings dark-mode switch shares the same store, so neither control goes stale.Note on #7702's criteria: "system" here is the default behaviour rather than a selectable option (a deliberate simplification, one-click beats a menu). If a returnable "System" choice is required, the store supports adding it in Account Settings later. Flagging for the issue author to confirm before this closes #7702.
Behaviour change to be aware of: users who never chose a theme now follow their OS, so dark-OS users get dark mode on first load after this ships.
How did you test this code?
tsc: 0 new errors vsmain;eslint: clean.ThemeTogglestory (flips the canvas theme live).Smoke test (enable
dark_mode_nav_togglefor your identity in the Staging environment of Flagsmith Website, then hard-refresh; run the dev server from this branch):