-
Notifications
You must be signed in to change notification settings - Fork 18
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
Merged
+1,457
−249
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
e0ff6e3
fix: enhance dark mode support in theme handling
elibosley 1b59aa0
test: update theme store tests to initialize dark mode from CSS variable
elibosley be3b9ae
test: simplify theme store test initialization
elibosley d2d9264
refactor: enhance dark mode handling and theme initialization
elibosley 73a32e2
feat: enhance banner gradient customization and update related tests
elibosley 2203f95
test: add theme store test for banner gradient configuration
elibosley 29c8fd8
test: update UserProfile tests to utilize theme store methods
elibosley 9f98ddd
test: enhance theme store tests with direct CSS variable manipulation
elibosley 4a14897
feat: add customization mutations for theme management
elibosley 1588bdc
feat: implement setTheme mutation for dynamic theme management
elibosley 3baa19e
feat: centralize dark mode detection with isDarkModeActive utility
elibosley bebc907
test: enhance useTeleport tests for dark mode functionality
elibosley 309aa5c
test: enhance theme store tests with dark mode detection and cleanup
elibosley 7db83af
test: update theme store tests for banner gradient configuration
elibosley 8a694d2
refactor: update banner visibility logic and CSS variable handling
elibosley e0a696a
fix: improve manifest content handling in WebComponentsExtractor
elibosley 610a742
fix: improve manifest content handling in WebComponentsExtractor
elibosley a314f5c
refactor: simplify banner gradient logic in theme store
elibosley c1e1a29
test: update UserProfile and theme store tests for banner gradient logic
elibosley b46faee
refactor: update CSS variables for theme gradients and shadows
elibosley 43e83e8
refactor: update header gradient handling for improved consistency
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
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
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
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?