feat: theme toggle - #8128
Draft
talissoncosta wants to merge 3 commits into
Draft
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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):