Skip to content

feat(components): add optional custom label to StatusDot#211

Merged
mikewheeleer merged 3 commits into
Agentpay-Org:mainfrom
real-venus:enhancement/components-statusdot-custom-label
Jun 29, 2026
Merged

feat(components): add optional custom label to StatusDot#211
mikewheeleer merged 3 commits into
Agentpay-Org:mainfrom
real-venus:enhancement/components-statusdot-custom-label

Conversation

@real-venus

Copy link
Copy Markdown
Contributor

feat(components): add optional custom label to StatusDot

Closes #152

What changed

src/components/StatusDot.tsx:

  • New label?: ReactNode prop that overrides the per-variant default text.
  • Safe fallback — an omitted, null, or empty-string label falls back
    to the variant default, so a visible text label is always present for screen
    readers (status is never conveyed by colour alone — WCAG 1.4.1).
  • Backward-compatible — the variant union (ok | warn | down), the
    aria-hidden colour dot, and the rendered DOM structure are unchanged for
    existing callers (admin/stats) that omit label.
  • JSDoc documenting the variants, the label override, and the accessibility
    rationale.

StatusDot hard-coded its three labels (Operational, Degraded, Down) with no
way to override the text, so surfaces like the admin page could not show a
state such as "Paused" with the same dot affordance.

- Add an optional `label?: ReactNode` prop that overrides the per-variant
  default text; an omitted, null, or empty-string value falls back to the
  default so a visible label is always present for screen readers
- Preserve the `variant` union (ok | warn | down), the aria-hidden colour dot,
  and the DOM structure for existing callers that omit `label`
- Add a JSDoc block documenting the variants and the label override
- Add src/components/__tests__/StatusDot.test.tsx covering default labels per
  variant, string and ReactNode overrides, empty-string/undefined fallback,
  and the aria-hidden dot (100% coverage of StatusDot.tsx)
- Document the new prop in docs/components.md
…nts-statusdot-custom-label

# Conflicts:
#	src/components/__tests__/StatusDot.test.tsx
Resolving the merge with main surfaced two pre-existing breakages on the
base branch that were blocking CI on this PR:

- src/app/docs/page.tsx referenced resolveApiBase() and <CurlBlock> without
  importing them, failing 'next build' typecheck. Add the missing imports.
- Two Header tests expected primary links to be marked aria-current twice
  (desktop + mobile), but the mobile nav panel only renders while open, so
  exactly one link is current at rest. Correct the assertions to match the
  component (and the tests' own 'exactly one' descriptions).
@real-venus

Copy link
Copy Markdown
Contributor Author

@mikewheeleer
Please review this.

@mikewheeleer

Copy link
Copy Markdown
Contributor

solid — in it goes 🚀

@mikewheeleer mikewheeleer merged commit 92d8e55 into Agentpay-Org:main Jun 29, 2026
1 check passed
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.

Add an inline status code and severity Badge to the StatusDot variants

2 participants