Skip to content

[dashboard-components] Extract shared renderLabeledSpan primitive for repeated inline label/value pairs - #3224

Merged
pelikhan merged 1 commit into
mainfrom
selfcare/dashboard-component-refactor-adcb7a038cbb8cb6
Sep 6, 2026
Merged

[dashboard-components] Extract shared renderLabeledSpan primitive for repeated inline label/value pairs#3224
pelikhan merged 1 commit into
mainfrom
selfcare/dashboard-component-refactor-adcb7a038cbb8cb6

Conversation

@cao-githubnext-gh-aw-cao-write

Copy link
Copy Markdown
Contributor

Duplicated call sites

Three places in the dashboard site rendered the same <span><strong>{label}</strong>{value}</span> inline metadata-pair markup by hand:

  • presenter.js — horizon tooltip window summary (Start / End / Duration)
  • components/ui-elements.js — control-plane readiness snapshot meta row (Snapshot / Evidence)

Extraction

Added renderLabeledSpan(label, value) to components/ui-primitives.js, alongside the existing renderDlRow/renderVitalStat shared primitives, and replaced the three duplicated call sites with it. No markup, class names, or DOM structure changed — only the construction site moved into a single shared helper.

Preserved behavior

  • Rendered output is byte-identical to before (<span><strong>label</strong>value</span>).
  • No public module API, accessibility semantics, or Dashboard Language behavior changed.
  • Added a focused unit test in test/unit/ui-primitives.test.js covering the new primitive (string value and node value).

Validation (from dashboard/site)

  • npm run typecheck
  • npm run lint
  • npm test ✅ 451/451 passed
  • npm run test:e2e ✅ 25/25 passed

Control Plane

Generated by SelfCare / Code Quality · copilot · auto · 102.8 AIC · ⌖ 8.1 AIC · ⊞ 12.4K ·

  • expires on Sep 13, 2026, 5:31 AM UTC

…adiness meta

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review September 6, 2026 05:42
Copilot AI lite review requested due to automatic review settings September 6, 2026 05:42

Copilot AI 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.

🟢 Approval recommended

The change is a small refactor with added unit coverage; only a minor JSDoc accuracy tweak was identified.

Pull request overview

This PR reduces duplicated inline “label/value” span markup in the dashboard site by extracting a shared renderLabeledSpan(label, value) helper into ui-primitives.js and updating existing call sites to use it.

Changes:

  • Added renderLabeledSpan(label, value) UI primitive for <span><strong>{label}</strong>{value}</span> rendering.
  • Replaced repeated inline metadata span construction in the horizon tooltip and readiness snapshot meta row with the new primitive.
  • Added a unit test covering string and Node values for the new primitive.
File summaries
File Description
dashboard/site/src/components/ui-primitives.js Adds the new shared renderLabeledSpan primitive and documents its intended usage.
dashboard/site/src/presenter.js Refactors horizon tooltip summary spans (Start/End/Duration) to use renderLabeledSpan.
dashboard/site/src/components/ui-elements.js Refactors readiness snapshot meta spans (Snapshot/Evidence) to use renderLabeledSpan.
dashboard/site/test/unit/ui-primitives.test.js Adds unit coverage for renderLabeledSpan with both string and Node values.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +104 to +108
* readiness snapshot meta row, which both present a bolded label followed by
* a plain-text value inside a single inline span.
* @param {string} label
* @param {unknown} value
* @returns {HTMLElement}

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed with codebase-design lens (refactor classification): this is a clean, low-risk extraction of a repeated <span><strong>{label}</strong>{value}</span> pattern into renderLabeledSpan in ui-primitives.js, alongside existing renderDlRow/renderVitalStat primitives — consistent with existing domain vocabulary. Output is byte-identical at all three call sites, imports are updated correctly, and a focused unit test covers both string and node value arguments. No authority/credential boundaries, workflow markdown sources, or generated lock files are touched. No actionable defects found.

Generated by Matt Pocock Skills Reviewer for #3224 · copilot · auto · 13.5 AIC · ⌖ 5.86 AIC · ⊞ 7.2K
Comment /matt to run again

@pelikhan
pelikhan merged commit 7908d27 into main Sep 6, 2026
25 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants