Skip to content

fix(miner-insights): render insight description body in Insights & Next Actions card#1183

Open
Khaostica wants to merge 1 commit into
entrius:testfrom
Khaostica:fix/insights-card-render-description
Open

fix(miner-insights): render insight description body in Insights & Next Actions card#1183
Khaostica wants to merge 1 commit into
entrius:testfrom
Khaostica:fix/insights-card-render-description

Conversation

@Khaostica
Copy link
Copy Markdown

Summary

The Insights & Next Actions card on every miner detail page silently dropped the description body under each insight. Each row rendered only the title + colored type chip (WARNING / TIP / ACHIEVEMENT) with empty space below it, removing all the actionable context users rely on.

Root cause: MinerInsightsCard.tsx had a self-closing <Typography sx={{...}} /> where {insight.description} was supposed to be rendered. The InsightItem interface declared description: string and all 8 insight builders (PR-mode + issue-mode) populated it correctly, but the JSX never emitted a child for it — so the styled <p> sat empty in the DOM on every row.

The fix is a one-line render change. The remaining diff extracts the pure insight-builder logic out of the JSX file into src/components/miners/minerInsights.ts so each builder can be unit-tested without standing up React DOM testing infrastructure (matching the existing src/tests/*.test.ts pure-logic convention). The new test file pins every builder's description-populating behavior so this regression cannot silently come back.

Changes

  • src/components/miners/MinerInsightsCard.tsx — adds {insight.description} as a child of the previously self-closing Typography. Removes the inlined insight builders/assemblers (now imported from ./minerInsights).
  • src/components/miners/minerInsights.ts (new) — pure module exporting InsightItem, InsightType, the 8 builders (getOpenPrInsight, getCredibilityInsight, getEligibilityInsight, getCollateralInsight, getOpenIssueRiskInsight, getIssueEligibilityInsight, getIssueCredibilityInsight, getIssueSolvedInsight), and assemblePrInsights / assembleIssueInsights. Behavior is identical to the previous inlined implementation — code was moved verbatim.
  • src/tests/minerInsights.test.ts (new) — 10 Vitest cases following the pure-logic pattern of the existing tests in src/tests/. Covers every builder and asserts both assemble-level outputs contain only insights with non-empty descriptions.

Related Issues

Closes #1182

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other (describe below)

Screenshots

Before:
Screenshot 2026-05-14 155955

After:
Screenshot 2026-05-14 155927

Checklist

  • New components are modularized/separated where sensible
  • Uses predefined theme (e.g. no hardcoded colors) — no styling changes; existing STATUS_COLORS + alpha() only
  • Responsive/mobile checked — render-only fix, no layout impact
  • Tested against the test API
  • npm run format and npm run lint:fix have been run
  • npm run build passes
  • Screenshots included for any UI/visual changes

…xt Actions card

The MinerInsightsCard rendered each insight's title + type chip but never
its description, because the JSX held a self-closing Typography where
{insight.description} should have been a child. The data was correct;
the render was empty.

Adds the missing description child and extracts the pure insight-builder
logic into src/components/miners/minerInsights.ts so a regression test
can pin every builder's description-populating behavior without standing
up React DOM testing infrastructure.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Miner Insights & Next Actions card never renders description body text — only titles show

2 participants