Code review of the dashboard branch. Four correctness bugs, one shared
helper, and the comment density brought down.
Correctness:
- CurrentlyDownCard: downSince() broke its backwards walk only on
`status === true`, so a check with an undefined status kept the run
going and reported a downtime reaching back to the start of the
retained window. Break on `status !== false` instead, matching what
the doc comment already claimed.
- RankingCards: the lowest-uptime card barred the uptime percentage
itself, so the worst monitor drew the shortest bar - a chart that read
as "best uptime" directly against its own title and sort order. Bar
the shortfall instead.
- useCardTransitions: the FLIP rAF and its nested 260ms timeout were
never cancelled. Navigating away mid-animation wrote styles to
unmounted nodes, and a second move while the first was settling had
its inversion wiped by the earlier timeout, so the card jumped rather
than travelled. Handles are now tracked and cancelled on unmount and
at the start of each move.
- BreakdownCard: the bar scale took buckets[0].total, silently assuming
the caller sorted descending. Compute the max instead - both callers
do sort today, but nothing in the signature said they had to.
Redundancy:
- "newest check is the last element of recentChecks" was implemented
twice with its own copy of the explanation. Now one `latestCheck`
helper in checks.ts. RankingCards averages over all checks, which is
a different operation, and is left alone.
- DEFAULT_CARD_IDS is `readonly` and copied into state rather than
assigned by reference.
Comments and conventions:
- 283 comment lines down to ~220. Design rationale ("two lines rather
than one wide row", "the header controls stay invisible until...")
is gone; comments recording non-obvious API facts - recentChecks is
oldest-first, snake_case here but camelCase there, credential fields
must not reach the DOM - are kept and shortened.
- DashboardCard: display/flexDirection/height hoisted out of sx to
native props (frontend rule 1). A stale comment claiming a "34px
control height" is corrected; the codebase settled on 32.
Gates: tsc clean, build passes, format-check clean, lint unchanged from
develop (12 errors, all pre-existing in untouched files).
This directory contains the client side (frontend) of Checkmate.