Skip to content

Rebuild AlertBox on BandedDiv - #2075

Closed
GregorShear wants to merge 4 commits into
greg/banded-divfrom
greg/alert-box
Closed

Rebuild AlertBox on BandedDiv#2075
GregorShear wants to merge 4 commits into
greg/banded-divfrom
greg/alert-box

Conversation

@GregorShear

@GregorShear GregorShear commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Changes

Rebuilds AlertBox on the BandedDiv from #2073. The severity color moves into the band; the copy sits on the face.

Stacked on #2073 (BandedDiv) and under #1989 (service accounts).

The component

  • The MUI Alert is gone, and with it the alertClasses overrides that were reshaping its icon, message, and action slots, plus iconMapping and SHARED_STYLING. The frame, the band tuck, and the severity-tinted face border all come from BandedDiv.
  • The band is bare — its color carries the severity on its own. side="left", radius="sm" (4px, matching the old alert), bandColor={theme.palette[severity][mode]} (unchanged from the old border color).
  • role="alert" and the forwarded ref land on the alert's content, which is what ValidationErrorSummary scrolls into view.
  • onClose renders its own close button now that MUI isn't supplying one.

The API

AlertBoxProps is severity, children, onClose, sx, title, and it moved next to the component. Removed:

  • short — 86 call sites set it, 82 of them the same way. A band reads the same whatever the message length, so there was nothing left for the compact/tall split to express.
  • headerMessage and the four alert.* messages — the h4 header they fed is gone. The one caller passes its copy as title.
  • hideIcon — nothing to hide once the icon went.
  • condensed on Error — it only ever picked the AlertBox presentation. Off 26 call sites.

alertBackground and alertTextPrimary came out of Theme.tsx, which had no other consumer for them.

AlertBox now has a named export alongside the default; the 77 existing importers are untouched.

Tests

Manually tested

  • /admin/billing against the local stack, both payment-provider alerts: band rgb(193,75,96) at a 24px visible run, face border 1px solid rgb(193,75,96), role="alert" present.

Automated tests

  • None. Typecheck, ESLint, and Prettier pass.

Screenshots

Band-only alert, dark mode — severity color at the left edge, copy on the face.

AlertBox is now a BandedDiv: the severity color goes in the band, the severity icon rides in it, and the face carries the copy. The frame, the band tuck, and the severity-tinted face border all come from the shared component, which replaces the MUI Alert along with the alertClasses overrides that were reshaping its icon, message, and action slots.

A band reads the same whatever the message length, so the compact/tall split has nothing left to express: `short` and `headerMessage` are ignored, and the h4 header they drew from the `alert.*` messages is gone. Call sites still pass both; the next commit takes them out.

AlertBoxProps moves next to the component, and the alert surface and text colors move out of Theme.tsx, which had no other consumer for them.
`short` and `headerMessage` came off every call site and out of AlertBoxProps. The one `headerMessage` caller passes its copy as `title` instead, and the four `alert.*` header messages are gone with the header that read them.

ControllerErrors was reaching through AlertBox's sx to widen `.MuiAlert-message`, a class no alert renders now; the face gives its content the full width already.
`condensed` did one thing: pick the AlertBox presentation that no longer exists. It came out of ErrorProps and off the 26 call sites that were setting it.
The band's color already says how severe the message is, and the icon repeated it without adding anything. With no icon, `hideIcon` has nothing to hide, so it comes off AlertBox, Error, and ValidationErrorSummary along with the call sites that were setting it.
@GregorShear GregorShear changed the title greg/alert box Rebuild AlertBox on BandedDiv Aug 28, 2026
@github-actions

Copy link
Copy Markdown

❌ Code Health

Introduces $\textcolor{red}{6}$ dead-code issues (removes $\textcolor{green}{1}$).

48 Unused files $\textcolor{green}{-1}$

File imported nowhere — delete (or import) it.

$\textcolor{green}{-}$ src/components/shared/BandedDiv.tsx
     src/hooks/useDelay.ts
     src/hooks/useDraft.ts
     src/pages/NoGrants.tsx
     src/pages/OAuth.tsx
     src/services/encryption.ts
     src/types/global.ts
     src/types/vitest.ts
     src/components/graphs/TaskHoursByMonthGraph.tsx
     src/components/tables/Link.tsx
…and 39 more

70 Unused exports $\textcolor{red}{+4}$

Exported symbol with no references outside its own file — un-export it, or delete it if unused entirely

$\textcolor{red}{+}$ src/components/shared/AlertBox.tsx : AlertBox
$\textcolor{red}{+}$ src/components/shared/BandedDiv.tsx : BANDED_DIV_FACE_CLASS
$\textcolor{red}{+}$ src/components/shared/BandedDiv.tsx : BAND_REST_SATURATION
$\textcolor{red}{+}$ src/components/shared/BandedDiv.tsx : desaturate
     src/context/Theme.tsx : logoColors
     src/context/Theme.tsx : intensifiedOutlineThick
     src/context/Theme.tsx : tableAlternateRowsSx
     src/context/Theme.tsx : draggableChipIconSx
     src/context/Theme.tsx : hiddenButAccessibleInput
     src/context/Theme.tsx : primaryColoredBackground_hovered
…and 60 more

32 Unused exported types $\textcolor{red}{+2}$

Exported type with no references outside its own file — un-export it, or delete it if unused entirely

$\textcolor{red}{+}$ src/components/shared/AlertBox.tsx : AlertBoxProps
$\textcolor{red}{+}$ src/components/shared/BandedDiv.tsx : BandSide
     src/utils/billing-utils.ts : FREE_GB_BY_TIER
     src/types/index.ts : InferredSchemas
     src/types/index.ts : Shard
     src/components/shared/WizardDialog/index.ts : WizardStep
     src/api/dataPlanes.ts : AwsDnsEntry
     src/stores/ShardDetail/types.ts : TaskShardDetailsWithShard
     src/stores/ShardDetail/types.ts : ShardDetails
     src/components/tables/Logs/types.ts : RefreshLogsFunction
…and 22 more

14 Unused exported enum members

An enum member referenced nowhere

     src/services/supabase.ts : CONNECTOR_TAGS
     src/services/supabase.ts : DRAFTS_EXT
     src/services/supabase.ts : TASKS_BY_DAY
     src/stores/Tables/hooks.ts : accessGrants
     src/stores/Tables/hooks.ts : accessLinks
     src/stores/Tables/hooks.ts : billing
     src/stores/Tables/hooks.ts : connectors
     src/stores/Tables/hooks.ts : entitySelector
     src/stores/Tables/hooks.ts : prefixes
     src/stores/Tables/hooks.ts : prefixAlerts
…and 4 more

5 Unused dependencies

In package.json but never imported

     package.json : @mui/lab
     package.json : @testing-library/jest-dom
     package.json : @urql/exchange-retry
     package.json : logrocket-react
     package.json : stripe

3 Unused devDependencies

In package.json devDependencies but never used

     package.json : @types/logrocket-react
     package.json : @types/react-inspector
     package.json : sharp

@GregorShear

Copy link
Copy Markdown
Contributor Author

Unwinding this — AlertBox stays on MUI Alert, and BandedDiv goes back into greg/access.

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