You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: implement dynamic score color for toolbar health indicators - #255
The reason will be displayed to describe this comment to others. Learn more.
🟢 Approval recommended
The changes are small, consistent with existing DOM structure/selectors, and apply styling in a self-contained way without altering score calculation logic.
Pull request overview
This PR adds dynamic colour styling for MageForge toolbar “health score” indicators so scores visually communicate severity (low/mid/high) across the home gauge, audit panel rings, and dashboard category badges.
Changes:
Introduces a shared _applyScoreColorClass() helper to consistently apply mageforge-score--low|mid|high based on score thresholds.
Updates score rendering to apply colour classes to the appropriate wrapper elements while still updating the numeric text.
Adds CSS rules mapping the score classes to the existing MageForge colour variables (red/yellow/green).
File summaries
File
Description
src/view/frontend/web/js/toolbar/ui/score.js
Applies score-based CSS classes while updating the displayed score values across toolbar widgets.
src/view/frontend/web/css/toolbar/_health.css
Defines the dynamic score colour styles for low/mid/high score states using MageForge CSS variables.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The new mid-score colour uses --mageforge-color-yellow instead of the toolbar’s established --mageforge-color-amber warning/mid token, creating an inconsistent palette.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
src/view/frontend/web/css/toolbar/_health.css:145
The mid-score colour uses --mageforge-color-yellow, but elsewhere the toolbar uses --mageforge-color-amber for warning/mid states (e.g. toolbar/_findings.css:58-62), and the doc comment above describes the mid range as “amber”. Using yellow here makes the palette inconsistent.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The new “mid” score styling uses --mageforge-color-yellow which conflicts with the toolbar’s established amber warning/mid palette, causing inconsistent severity colouring.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Confirmed logic issues in score colour application (NaN handling and missing colour application for ring widgets) should be fixed before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (2)
Previously missed (2) — in code that hasn't changed since the last review.
src/view/frontend/web/js/toolbar/ui/score.js:31
_applyScoreColorClass treats NaN as a valid score (all comparisons are false, so it falls into the “high” branch). This can incorrectly colour the UI green if an upstream calculation yields NaN/undefined. src/view/frontend/web/js/toolbar/ui/build.js:120
The PR title is scoped to “dynamic score color”, but this change set also adds a theme toggle UI in the header and refactors the footer/export controls. Consider either splitting these UI changes into a separate PR or updating the PR title/description to reflect the additional behaviour so reviewers can assess scope and risk appropriately.
These new theme buttons call setTheme, which stores the selection in localStorage, but init() always restores only the server-provided data-theme and never reads that key. As a result, a user's choice is lost on every page reload; load and validate the stored theme (with the configured value as fallback), or remove the persistence write.
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
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.
No description provided.