Skip to content

Replace blackout status icon with FrontHandSharp - #393

Open
susan-pgedge wants to merge 2 commits into
mainfrom
feature/blackout-icon-front-hand
Open

Replace blackout status icon with FrontHandSharp#393
susan-pgedge wants to merge 2 commits into
mainfrom
feature/blackout-icon-front-hand

Conversation

@susan-pgedge

@susan-pgedge susan-pgedge commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

Replaces the crescent-moon DarkMode icon in the StatusPanel selection
header's blackout-management control with a FrontHandSharp raised
open-palm "stop" gesture, matching the icon requested by name from the
mui.com icon gallery.

This is a pure visual swap. The IconButton, Tooltip, Badge,
sx={{ fontSize: 20 }} sizing, and onBlackoutClick behaviour are all
unchanged.

Why a custom SVG instead of an @mui/icons-material import

FrontHandSharp is not exported by the pinned
@mui/icons-material@5.18.0 (confirmed: no FrontHand* files ship in
that package; only BackHand exists in 5.x). The icon first appears in
MUI's v6 icon set, and @mui/icons-material@6's peer dependency
requires @mui/material@^6, while this client is pinned to
@mui/material@^5.14.20. Bumping the entire MUI major version just to
add one icon is out of scope and too risky for this change, so no MUI
package version was touched
.

Instead, the icon is recreated locally with MUI's public
createSvgIcon utility (the same documented, supported mechanism
@mui/icons-material uses internally), using the exact path data MUI
publishes for FrontHandSharp in the upstream mui/material-ui repo.

Where the component lives

Co-located directly in SelectionHeader.tsx. The codebase has no
existing shared-icons directory and no prior createSvgIcon precedent,
so introducing a new components/icons/ convention for a single
one-off icon would be premature; keeping it local is the
least-surprising choice.

Tests

SelectionHeader was previously mocked out (vi.mock('../SelectionHeader', ...))
in every StatusPanel test, so it had no rendering coverage. This PR adds
a dedicated SelectionHeader.test.tsx covering every branch (selection
types, status-driven colour and tooltip text, the alert-count badge and
its 99+ clamp, and the blackout button's active/inactive tooltip and
click handler). The modified file now reports 100% line coverage.

The full client suite passes: 172 test files, 3500 tests. ESLint
reports zero errors on the changed files.

Note: a fresh npm ci in this worktree surfaces a pre-existing,
repo-wide tsc --noEmit baseline of 574 errors from toolchain
version drift (newer TypeScript/@types, vitest v4 MockInstance/vi
globals, PaletteMode removed from newer @mui types). This PR is
type-neutral: the error count is identical (574) with and without the
change, and the only SelectionHeader.tsx errors are on pre-existing
alert-severity sort code that this PR did not author or modify.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Replaced the unavailable dark mode icon with a compatible blackout icon across blackout-related controls. No user-facing behavior changed.
  • Tests

    • Added coverage for selection labels, status tooltips, alert counts, severity summaries, blackout button states, and blackout interactions.
    • Added coverage for blackout dialog states, active and scheduled blackout details, time formatting, and stop, delete, close, and create actions.

Swap the crescent-moon DarkMode icon in the StatusPanel selection
header's blackout-management control for a FrontHandSharp "stop"
gesture, matching the requested mui.com icon.

FrontHandSharp is not exported by the pinned @mui/icons-material@5.x
package; it first ships in the v6 icon set, whose peer dependency
requires @mui/material@^6. Bumping the MUI major just for one icon is
out of scope, so the icon is recreated locally with MUI's public
createSvgIcon utility using the exact path data MUI publishes for
FrontHandSharp. This is a pure visual swap: the IconButton, Tooltip,
Badge, sizing, and click behaviour are unchanged.

Add a dedicated SelectionHeader test (the component was previously
mocked out in every StatusPanel test, leaving it uncovered); it now
covers every branch at 100% line coverage.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The change adds a shared BlackoutIcon, replaces DarkMode imports in three blackout components, and adds tests for SelectionHeader and BlackoutManagementDialog.

Changes

Blackout updates

Layer / File(s) Summary
Shared blackout icon integration
client/src/components/shared/BlackoutIcon.tsx, client/src/components/StatusPanel/SelectionHeader.tsx, client/src/components/BlackoutManagementDialog.tsx, client/src/components/BlackoutPanel.tsx
Adds BlackoutIcon with createSvgIcon and FrontHandSharp path data. The three components use it instead of DarkMode.
SelectionHeader behavior tests
client/src/components/StatusPanel/__tests__/SelectionHeader.test.tsx
Adds fixtures, themed rendering helpers, and tests for labels, statuses, alerts, badge clamping, blackout states, and click handling.
BlackoutManagementDialog behavior tests
client/src/components/__tests__/BlackoutManagementDialog.test.tsx
Adds tests for dialog states, blackout actions, metadata, schedules, deletion, time formatting, and creation dialogs.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: dpage

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: replacing the blackout status icon with FrontHandSharp.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/blackout-icon-front-hand

Comment @coderabbitai help to get the list of available commands.

@codacy-production

codacy-production Bot commented Aug 6, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 55 complexity

Metric Results
Complexity 55

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@susan-pgedge
susan-pgedge requested a review from dpage August 6, 2026 13:54
Extract the createSvgIcon FrontHandSharp definition into a single shared
module (client/src/components/shared/BlackoutIcon.tsx) and consume it from
the three places that previously showed the old DarkMode moon icon:

  - StatusPanel/SelectionHeader.tsx (already swapped in the prior commit;
    now imports the shared component instead of defining it locally).
  - BlackoutManagementDialog.tsx (active-blackout banner).
  - BlackoutPanel.tsx (active-blackout banner).

With three usages, a single shared module is more maintainable than
triplicating the hardcoded SVG path string; the components/shared
directory is the established home for reusable UI primitives. Each usage
site keeps its existing sizing/props unchanged (sx={activeIconSx} and
sx={iconSx}), so this remains a pure icon swap.

Add a TODO on the shared definition to remove it in favour of importing
FrontHandSharp directly from @mui/icons-material once the project moves
to MUI v6+.

Add a dedicated BlackoutManagementDialog test; the dialog previously had
no coverage (it is mocked to null wherever it appears). The new suite
covers the empty state, the active/non-active/schedule sections, the
time-format branches, the delete-confirmation flows, the create actions,
and close, reaching ~97% line coverage. The shared icon module and
SelectionHeader remain at 100%; BlackoutPanel stays at ~96%.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
client/src/components/BlackoutPanel.tsx (1)

31-31: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Rename the import alias to BlackoutIcon.

BlackoutIcon is imported as MoonIcon, and the component still renders <MoonIcon>. This works at runtime, but it leaves obsolete terminology in the blackout path and can mislead future changes. Rename the alias and its JSX usage to BlackoutIcon.

Proposed fix
-import MoonIcon from './shared/BlackoutIcon';
+import BlackoutIcon from './shared/BlackoutIcon';
🤖 Prompt for 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.

In `@client/src/components/BlackoutPanel.tsx` at line 31, Rename the imported
alias from MoonIcon to BlackoutIcon in BlackoutPanel and update the
corresponding JSX usage from <MoonIcon> to <BlackoutIcon>, preserving the
existing component behavior.
🤖 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.

Nitpick comments:
In `@client/src/components/BlackoutPanel.tsx`:
- Line 31: Rename the imported alias from MoonIcon to BlackoutIcon in
BlackoutPanel and update the corresponding JSX usage from <MoonIcon> to
<BlackoutIcon>, preserving the existing component behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c10802e3-2f89-4067-a7ed-9e554d6a8e0b

📥 Commits

Reviewing files that changed from the base of the PR and between 9bd4e44 and 7a05ae3.

📒 Files selected for processing (5)
  • client/src/components/BlackoutManagementDialog.tsx
  • client/src/components/BlackoutPanel.tsx
  • client/src/components/StatusPanel/SelectionHeader.tsx
  • client/src/components/__tests__/BlackoutManagementDialog.test.tsx
  • client/src/components/shared/BlackoutIcon.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • client/src/components/StatusPanel/SelectionHeader.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant