[1 / 7] - Profile theming (foundation)#198
Conversation
📝 WalkthroughWalkthroughAdds a per-user admin dark mode toggle stored in ChangesDark Mode Toggle + Character Row Theming
Sequence Diagram(s)sequenceDiagram
actor User
participant AdminBar as WP Admin Bar
participant InlineJS as acore_dark_mode_js
participant AjaxHandler as wp_ajax_acore_toggle_dark_mode
participant UserMeta as WP User Meta
User->>AdminBar: Click dark mode toggle
AdminBar->>InlineJS: click event on `#acore-dark-mode-toggle`
InlineJS->>AjaxHandler: POST action=acore_toggle_dark_mode + nonce
AjaxHandler->>AjaxHandler: check_ajax_referer()
AjaxHandler->>UserMeta: get_user_meta(acore_dark_mode)
UserMeta-->>AjaxHandler: current value ('0' or '1')
AjaxHandler->>UserMeta: update_user_meta(flipped value)
AjaxHandler-->>InlineJS: JSON {dark: true/false}
InlineJS->>AdminBar: toggle body.acore-dark-mode class
InlineJS->>AdminBar: update icon (☀/🌙) and title text
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/acore-wp-plugin/src/Utils/AcoreCharColors.php`:
- Around line 84-93: The rowStyle() method in AcoreCharColors.php is including
inline border declarations (border-top, border-right, border-bottom,
border-left) that override the active-state border styling rules defined in
main.css. Remove all border-related properties from the sprintf statement in the
rowStyle() method, keeping only the CSS custom properties declarations
(--cls-light, --cls-dark, --faction-color). This allows the stylesheet to
control the border styling for active and inactive states without inline style
conflicts.
In `@src/acore-wp-plugin/web/assets/css/dark-mode.css`:
- Around line 114-124: The `.acore-expansion-option input[type="radio"]`
selector hides the radio inputs for visual purposes, but there is no visible
focus indicator for keyboard users to know which option has focus. Add focus
styling for these hidden radio inputs using the `:focus-visible` pseudo-class
selector on the `.acore-expansion-option input[type="radio"]` element, and apply
visible focus styles (such as outline or border) to the associated visible
option container element. The same focus styling should be applied to all
similar hidden radio input patterns mentioned in the file (at the locations
indicated).
In `@src/acore-wp-plugin/web/assets/css/main.css`:
- Around line 691-695: The `.item-restore-grid` class currently hard-codes a
4-column layout that overflows on narrow screens. Add media queries below this
rule to make the grid responsive: for tablets and smaller devices, reduce to 3
columns using an appropriate mobile breakpoint, then further reduce to 2 columns
for even smaller screens, and finally to 1 column for the smallest mobile
widths. Adjust the grid-template-columns property at each breakpoint while
keeping the gap value consistent across all sizes.
In `@src/acore-wp-plugin/web/assets/css/theme.css`:
- Around line 590-596: The CSS rule for the `#search-submit` input selector in the
dark-mode section is too broadly scoped and will affect search buttons on
unrelated admin pages beyond just the myCRED page. Modify the selector by
nesting it under the .mycred-log-page class so that the background, border, and
color overrides for body.acore-dark-mode `#wpbody-content` input#search-submit
only apply when on the myCRED log page, consistent with the surrounding rules in
the stylesheet.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 77febdb6-202d-40c0-b6cf-b1fe4887cbcd
📒 Files selected for processing (6)
src/acore-wp-plugin/src/Hooks/Various/DarkMode.phpsrc/acore-wp-plugin/src/Utils/AcoreCharColors.phpsrc/acore-wp-plugin/src/boot.phpsrc/acore-wp-plugin/web/assets/css/dark-mode.csssrc/acore-wp-plugin/web/assets/css/main.csssrc/acore-wp-plugin/web/assets/css/theme.css
|
The reviews are valid for this, but the are fixed in the on the way to latest PR and including he last PR #205 |
Split from the main PR: #197
Split by Claude
Adds the Dark/Light mode toggle, remembered per-user in the WP DB, across all user + AC admin pages (light stays default). Ships the shared CSS and the character-colour helper (class/faction colours, level badges) that the other branches build on.
Summary by CodeRabbit
Release Notes
New Features
Style