-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bring back dark mode support with simpler logic #107
Merged
Conversation
This file contains 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
Owner
dkhalife
commented
Mar 3, 2025
- merge storage context into themecontext
- TokenManager -> api util
- reduce themecontext
- lowercase util files
- dead code
- remove Contexts
- remove theme from app
- JoyUI to save in custom storage key
- remove custom ThemeContext
- remove custom ThemeMode
- simplify theme toggles
- apply theme
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR refactors and simplifies theming by merging storage context into theme context, streamlining theme toggles, and removing unused context code.
- Consolidates theme management and storage logic in src/constants/theme.ts
- Simplifies toggle button components by removing the ThemeContext dependency and relying on direct state and util function updates
- Removes obsolete context and custom theme types and utilizes JoyUI’s CssVarsProvider for theming
Reviewed Changes
File | Description |
---|---|
src/constants/theme.ts | Centralizes theme logic and introduces helper functions for mode handling |
src/views/Settings/ThemeToggleButton.tsx | Updates toggle behavior to work purely on component state |
src/App.tsx | Removes unused theme code and integrates CssVarsProvider |
src/views/Settings/ThemeToggle.tsx | Refactors theme toggle control to remove context dependency |
src/utils/dom.ts | Adds applyTheme utility to update the document’s theme data attribute |
src/views/Settings/Settings.tsx | Removes ThemeContext usage and simplifies settings view |
src/views/Navigation/NavBar.tsx | Strips out ThemeContext consumer and adjusts theme toggle placement |
src/contexts/ThemeContext.tsx | Eliminates obsolete theming context |
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
src/constants/theme.ts:15
- The function getNextThemeMode does not handle the 'system' theme mode, which could lead to undefined behavior when the current mode is 'system'. Consider adding an explicit case or a default branch to handle this scenario.
export const getNextThemeMode = (currentThemeMode: Mode): Mode => {
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.