wrolpi/app/src/components/ui
Roland 7a6b09aee6
ui: route genuine success and failure through the roles
Sixteen call sites, chosen by reading each one rather than by grepping for a
hue.  Four sub-agents judged them independently against one rule: convert only
what genuinely means success or failure; identification, category and
decoration stay hue-named.

Converted:
  SMART drive health (all four branches -- PASS/WARN/FAIL/unknown)
  config validity: valid / invalid / empty
  "Failed to load preview"
  the two "Download error" triggers
  expired inventory items, desktop and mobile
  the refresh phases: complete / active / not reached
  a refresh Progress bar in its error state
  cookie status: Unlocked / Locked
  a chip-mismatch label on the flasher
  CPU load thresholds (LoadStatistic)
  the outcome of an API call in useAPIButton
  the gallery's "Danger zone" heading and its load readings

Left alone, deliberately:
  the file browser toolbar -- every action has its own colour to be told apart,
    and delete already uses role='danger' (Roland's ruling)
  diff add/remove in the config and inventory import previews.  Adding is not a
    success and removing is not a failure; in Overwrite mode the removals are
    exactly what the user asked for, and painting them danger would report their
    intended action as broken
  seasons in DatesSelector, the uploader star and favourite heart, TagIcon,
  downloader category buttons, "Recommended to Keep"

Three sites were wrong in a way worth naming.  Both "Download error" triggers
guard on the same condition and render the same modal, but one was `orange` and
the other `red` -- and `orange` is the single worst choice, byte-identical to
`--text` in night, so that error button was indistinguishable from an ordinary
control.  Config validity drew its valid state in `--violet`, which no user
parses as "valid".  And `LoadStatistic` -- the thing users actually watch on the
Status page -- rendered its warning threshold in that same invisible orange.

Also fixed a stale comment in Videos.js that claimed no token existed for these.

Two notes on the tests:

The first LoadStatistic test I wrote rendered the component and asserted the
inline colour.  jsdom REJECTS `color: var(--danger)` as an invalid declaration
and drops it, so every colour reads back as the empty string -- two of the four
assertions passed for that reason alone and would have kept passing with the
hues restored.  It is a source guard now, with the painted result asserted in
the browser instead.

That browser test then found something real: an uncoloured reading inherits
`--text`, which in night is 4.98:1 against `--warning`'s 4.91:1, so a machine
under load is marginally QUIETER than one that is fine.  Not fixed here.  The
only way up on a dark panel is lightness, and night's danger would desaturate
from #ff3e3e to about #ff5d5d -- trading the theme's "red only" character for
loudness.  That is a palette decision, so the test documents it and asserts what
does hold rather than quietly making it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-08 18:05:46 -06:00
..
Button.tsx ui: three silent library defects the agents' reports surfaced 2026-08-08 18:04:02 -06:00
DataTable.tsx ui: give tables a real header, drop the column grid, quiet the row rules 2026-08-08 18:05:45 -06:00
Feedback.tsx ui: semantic roles, so night and amber can tell severity apart at all 2026-08-08 18:05:46 -06:00
Icon.tsx ui: map the twelve icon names that were rendering as question marks 2026-08-08 18:05:45 -06:00
index.ts ui: nine leaf files off Semantic, and the components they needed 2026-08-08 18:04:00 -06:00
Inputs.tsx ui: name the directory fields, announce their help text, let long prefixes shrink 2026-08-08 18:04:04 -06:00
Navigation.tsx ui: nine leaf files off Semantic, and the components they needed 2026-08-08 18:04:00 -06:00
Overlays.tsx ui: migrate the extension pages and Configs; five components they needed 2026-08-08 18:04:00 -06:00
SearchBox.tsx ui: fix the cypress failures, and two real defects behind them 2026-08-08 18:04:01 -06:00
Surfaces.tsx ui: Statistic and StatisticGroup, and the four defects they had 2026-08-08 18:05:44 -06:00
ThemePicker.tsx ui: media filtering is a per-theme setting, not a night-mode hardcode 2026-08-08 18:04:00 -06:00
toast.test.js ui: semantic roles, so night and amber can tell severity apart at all 2026-08-08 18:05:46 -06:00
toast.ts ui: semantic roles, so night and amber can tell severity apart at all 2026-08-08 18:05:46 -06:00
ui-layout.cy.js ui: route genuine success and failure through the roles 2026-08-08 18:05:46 -06:00
ui.css test: act on review — and correct an overstated claim about the toast bug 2026-08-08 18:05:46 -06:00
ui.test.js test: act on review — and correct an overstated claim about the toast bug 2026-08-08 18:05:46 -06:00