-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat(web): add theme changer and OLED theme #8022
base: master
Are you sure you want to change the base?
Conversation
ArtifactsThese changes are published for testing on Buildkite, DockerHub and GitHub Container Registry. Docker Container
|
WalkthroughThe pull request introduces several enhancements to the Authelia configuration documentation and codebase. It adds a new theme option, "oled," updates the Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for authelia-staging ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (6)
web/src/components/ThemeChanger.tsx (2)
14-22
: You got your themes lined up like my gold chains! But listen here, fool!I like what you did with them themes, sucka! You got 'em all neat and tidy. But check this out: you could make that CurrentIcon selection even slicker!
Try this on for size:
-const CurrentIcon = themes.find((t) => t.value === themeName)?.icon || BrightnessAuto; +const CurrentIcon = themes.find((t) => t.value === themeName)?.icon ?? BrightnessAuto;Using the nullish coalescing operator (
??
) instead of logical OR (||
) is more precise, fool! It only falls back if the icon is null or undefined, not for any falsy value. I pity the fool who don't use modern JavaScript features!
37-65
: Your render method is rendering fools speechless! But listen up, sucka!I pity the fool who don't make their UI accessible! You're doing good with them aria attributes, but we can make it even better!
Add this to your IconButton, fool:
<IconButton onClick={handleClick} aria-label="change theme" aria-controls="theme-menu" aria-haspopup="true" + aria-expanded={Boolean(anchorElement)} sx={{ color: theme.palette.text.primary, }} >
This
aria-expanded
attribute tells screen readers if the menu is open or closed. That's how we make our UI sing for everyone, you hear me?web/src/themes/Oled.ts (3)
4-7
: Hey fool, your custom properties are lookin' good!I like what you did with them custom properties, sucka! But listen up, fool! You might wanna consider usin' a slightly off-white color for better eye comfort in the dark. How about "#f0f0f0" instead of "#fff"? That's the kind of detail Mr. T appreciates!
13-42
: Listen up, fool! Your color game is strong, but it ain't perfect!I like what you did with them colors, sucka! But Mr. T thinks you could make it even better! How about we make them warning colors pop a little more? Try changin' the warning.main to "#ffa726" for more punch! And don't forget to adjust the other warning shades to match, fool!
43-87
: Alright, fool! Your theme's lookin' sharp, but Mr. T's got some advice!I pity the fool who don't appreciate this detailed color scheme! But listen up, sucka! That pure black background might be too harsh on some eyes. How about we soften it up a bit? Try usin' "#0a0a0a" instead of "#000000" for the background. It'll still save energy on them OLED screens, but it'll be easier on the eyes!
And don't forget to export that theme, fool! Good job on that last line!
web/src/contexts/ThemeContext.tsx (1)
131-132
: Listen up, fool! This OLED theme addition is lookin' good!I pity the fool who don't appreciate good code! You done good addin' that OLED theme, sucka! It's tight and right, just like my gold chains!
But listen here, fool! To make this code shine brighter than my bling, consider movin' this new case up with its dark-themed brothers. Put it right after the
ThemeNameDark
case. That'll make the code flow smoother than my mohawk, fool!
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (7)
- docs/content/configuration/miscellaneous/introduction.md (1 hunks)
- internal/configuration/schema/configuration.go (1 hunks)
- web/src/components/ThemeChanger.tsx (1 hunks)
- web/src/contexts/ThemeContext.tsx (1 hunks)
- web/src/layouts/LoginLayout.tsx (2 hunks)
- web/src/themes/Oled.ts (1 hunks)
- web/src/themes/index.ts (1 hunks)
🧰 Additional context used
🔇 Additional comments (11)
web/src/themes/index.ts (2)
30-30
: Listen up, fool! This new theme's gonna rock your world!I pity the fool who don't appreciate this new OLED theme constant! It's consistent with the other theme names and gonna give users more options. That's what I call smart coding!
35-35
: You better believe this OLED theme's the real deal!I pity the fool who don't see how awesome this new OLED theme export is! It's right in line with the other theme exports, makin' it available for the whole app to use. That's what I call teamwork!
But listen up, sucka! We gotta make sure this Oled theme file exists and is up to snuff. Run this command to check it out:
If this command don't show nothin', you better get to work on that Oled theme file, fool!
✅ Verification successful
Yo, listen up! The
Oled.ts
file gotta be on point, ya hear? Let’s double-check that bad boy exists and got the right theme stuff in there. Run this command, and make sure everything's tight:
Oled Theme Verified and Solid!
I pity the fool who doubts this, the Oled theme is locked and loaded! The
Oled.ts
file exists and it's packing all the theme-related code needed. You're good to go, brother!🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the Oled theme file exists and contains theme-related code # Test: Check if the Oled theme file exists and contains theme-related code rg --type typescript -e 'createTheme' -e 'ThemeOptions' web/src/themes/Oled.tsLength of output: 111
Script:
#!/bin/bash # Description: Verify the Oled theme file exists and contains theme-related code # Test: Check if the Oled theme file exists and contains theme-related code rg --type ts -e 'createTheme' -e 'ThemeOptions' web/src/themes/Oled.tsLength of output: 147
web/src/components/ThemeChanger.tsx (3)
1-12
: I pity the fool who don't use proper imports! But you ain't no fool!Listen up, sucka! Your imports and component declaration are tight! You got all the right stuff from React and Material-UI. And that useThemeContext hook? That's some smooth operating right there!
24-35
: Your handlers are handling business like I handle fools!Listen up, sucka! Your event handlers are tight! They're doing their job like a well-oiled machine. You're setting that anchor, closing that menu, and changing that theme like a boss! That's how we do it in the A-Team of coding!
68-68
: You're exporting like a champ, fool!That's how you do it! Exporting your component like a boss. Simple, clean, and effective. I pity the fool who can't import this beauty of a component!
web/src/themes/Oled.ts (2)
1-3
: Listen up, fool! This import and theme creation is solid gold!I pity the fool who don't use
createTheme
from Material-UI! You done good, sucka!
8-12
: I pity the fool who don't appreciate this dark mode and primary color!You got it right, sucka! That dark mode is perfect for OLED, and that blue primary color gonna pop like my gold chains!
docs/content/configuration/miscellaneous/introduction.md (1)
82-87
: Listen up, fool! We got a new theme in town!I pity the fool who don't know about this new OLED theme! It's as shiny as my gold chains, and it's gonna make your eyes pop like my mohawk! This change is solid gold, just like me!
web/src/layouts/LoginLayout.tsx (2)
12-12
: Listen up, fool! This import's lookin' good!I pity the fool who don't import their components right! But you, you've done good. That ThemeChanger import is sittin' pretty with the other imports, usin' that "@components" alias like a champ. Keep it up, sucka!
47-47
: Hey fool, your ThemeChanger's in the right spot!I pity the fool who don't know where to put their components! But you, you've got it right. That ThemeChanger's sittin' pretty in the AppBar, right where users can see it. It's pushed to the right side, lookin' all fancy next to the account settings. That's some smart thinkin', fool!
But listen up! I don't see no props on that ThemeChanger. Maybe it don't need 'em, but you better double-check, sucka! We don't want no half-baked components 'round here!
Run this script to check if ThemeChanger needs any props:
internal/configuration/schema/configuration.go (1)
9-9
: Listen up, fool! This change looks good, but we gotta make sure it's tight everywhere!I pity the fool who doesn't check their work! The new 'oled' theme option is in there good, but we gotta make sure the rest of the code knows about it too!
Run this script to check if we missed any spots, fool!
✅ Verification successful
I pity the fool who didn't catch that mistake! The
rg
command threw a fit because 'typescript' ain't a recognized type. Let's set it straight and run this new script to make sure that 'oled' theme is solid everywhere!
I pity the fool who forgot to check for 'oled'! Let’s run this script to make sure 'oled' is rocking all over the codebase!
All Systems Go for the 'Oled' Theme! I pity the fool who didn't update everywhere!
The new 'oled' theme is rockin' all over the codebase! Everything looks tight and proper!🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check if the new 'oled' theme is used consistently across the codebase # Test: Search for theme-related code that might need updating rg --type go --type typescript --type javascript -i '\btheme\b' -C 5Length of output: 105
Script:
#!/bin/bash # Description: Check if the new 'oled' theme is used consistently across the codebase # Test: Search for theme-related code that might need updating rg --type go --type js --type ts -i '\btheme\b' -C 5Length of output: 89381
Script:
#!/bin/bash # Description: Check if the new 'oled' theme is used anywhere in the codebase # Test: Search for 'oled' theme usage rg --type go --type js --type ts -i '\boled\b' -C 5Length of output: 4750
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8022 +/- ##
==========================================
+ Coverage 73.75% 73.77% +0.02%
==========================================
Files 347 349 +2
Lines 30209 30228 +19
Branches 850 852 +2
==========================================
+ Hits 22280 22302 +22
+ Misses 7052 7051 -1
+ Partials 877 875 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Add a theme changer drop down to Login Portal and Authenticated Pages, allowing users to easily set their current device's theme.
Additionally added a new OLED theme.