-
Notifications
You must be signed in to change notification settings - Fork 13
fix: enhance dark mode support in theme handling #1808
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
Open
elibosley
wants to merge
14
commits into
main
Choose a base branch
from
feat/dark-mode
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
1d24678
fix: enhance dark mode support in theme handling
elibosley b92c5d2
test: update theme store tests to initialize dark mode from CSS variable
elibosley 1e553bc
test: simplify theme store test initialization
elibosley 78e59cc
refactor: enhance dark mode handling and theme initialization
elibosley e6f130b
feat: enhance banner gradient customization and update related tests
elibosley 71324e8
test: add theme store test for banner gradient configuration
elibosley 05512cb
test: update UserProfile tests to utilize theme store methods
elibosley f552d84
test: enhance theme store tests with direct CSS variable manipulation
elibosley d9c4b01
feat: add customization mutations for theme management
elibosley 7ffdc1f
feat: implement setTheme mutation for dynamic theme management
elibosley d5f5b67
feat: centralize dark mode detection with isDarkModeActive utility
elibosley 586d5c8
test: enhance useTeleport tests for dark mode functionality
elibosley 448d3e1
test: enhance theme store tests with dark mode detection and cleanup
elibosley 452bf57
test: update theme store tests for banner gradient configuration
elibosley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
4 changes: 3 additions & 1 deletion
4
api/src/unraid-api/graph/resolvers/customization/customization.module.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,11 @@ | ||
| import { Module } from '@nestjs/common'; | ||
|
|
||
| import { CustomizationMutationsResolver } from '@app/unraid-api/graph/resolvers/customization/customization.mutations.resolver.js'; | ||
| import { CustomizationResolver } from '@app/unraid-api/graph/resolvers/customization/customization.resolver.js'; | ||
| import { CustomizationService } from '@app/unraid-api/graph/resolvers/customization/customization.service.js'; | ||
|
|
||
| @Module({ | ||
| providers: [CustomizationService, CustomizationResolver], | ||
| providers: [CustomizationService, CustomizationResolver, CustomizationMutationsResolver], | ||
| exports: [CustomizationService], | ||
| }) | ||
| export class CustomizationModule {} |
25 changes: 25 additions & 0 deletions
25
api/src/unraid-api/graph/resolvers/customization/customization.mutations.resolver.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { Args, ResolveField, Resolver } from '@nestjs/graphql'; | ||
|
|
||
| import { AuthAction, Resource } from '@unraid/shared/graphql.model.js'; | ||
| import { UsePermissions } from '@unraid/shared/use-permissions.directive.js'; | ||
|
|
||
| import { CustomizationService } from '@app/unraid-api/graph/resolvers/customization/customization.service.js'; | ||
| import { Theme, ThemeName } from '@app/unraid-api/graph/resolvers/customization/theme.model.js'; | ||
| import { CustomizationMutations } from '@app/unraid-api/graph/resolvers/mutation/mutation.model.js'; | ||
|
|
||
| @Resolver(() => CustomizationMutations) | ||
| export class CustomizationMutationsResolver { | ||
| constructor(private readonly customizationService: CustomizationService) {} | ||
|
|
||
| @ResolveField(() => Theme, { description: 'Update the UI theme (writes dynamix.cfg)' }) | ||
| @UsePermissions({ | ||
| action: AuthAction.UPDATE_ANY, | ||
| resource: Resource.CUSTOMIZATIONS, | ||
| }) | ||
| async setTheme( | ||
| @Args('theme', { type: () => ThemeName, description: 'Theme to apply' }) | ||
| theme: ThemeName | ||
| ): Promise<Theme> { | ||
| return this.customizationService.setTheme(theme); | ||
| } | ||
| } |
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
i get antipattern/red flag vibes from this (ie multiple ways to set dark mode, multiple places you have to consider to debug themes--which could step on each others' toes)
i suspect this is in the spirit of a css implementation of the dark mode recognition we were doing in js, though.
for my own context, what are the limitations of purely setting a css var palette based on theme? is it the use of
dark:styles in our component code & component dependencies?