refactor(trustlines): adopt shared InsightsList component - #212
Open
samuel2926i39-art wants to merge 1 commit into
Open
refactor(trustlines): adopt shared InsightsList component#212samuel2926i39-art wants to merge 1 commit into
samuel2926i39-art wants to merge 1 commit into
Conversation
AssetInsights on the trustlines page had its own bespoke loading skeleton, empty-state message, and bullet list markup that duplicated what the shared dashboard/InsightsList component already provides (loading, error, and empty states + list rendering, with tests). Delegate list/loading/empty rendering to InsightsList so trustlines becomes its first real consumer, keeping only the asset-specific sentence-generation logic and card chrome in AssetInsights. Adds a test file for AssetInsights covering the loading, empty, and happy-path states, following the existing dashboard test convention. Closes Stellar-Insightss#152 Closes Stellar-Insightss#157
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AssetInsights(the insight callout on the trustlines/Asset Intelligence page, #150/#152) had its own bespoke loading skeleton, empty-state copy, and bullet-list markup. Meanwhiledashboard/InsightsList(#157) already implements exactly that — loading, error, and empty states plus list rendering — with its own test coverage, but had zero consumers anywhere in the codebase.This PR makes trustlines the first real consumer of
InsightsList, per #157's own suggested approach ("Refactor #150/#152's AssetInsights to use this once it exists"):AssetInsightsnow delegates loading/empty/list rendering toInsightsList, passing in the asset-specific generated sentences and a tailored empty message ("Insufficient data to generate insights for this asset.").buildSentences) and the card chrome (icon + heading) are unchanged — only the previously-duplicated state/list markup was removed.data,loading), sotrustlines/page.tsxneeded no changes.Before / after
AssetInsightshad its own 3-bar loading skeleton and its own "›"-prefixed bullet list.InsightsList's loading skeleton (SkeletonText) and list items (data-testid="insights-list"), matching the visual/behavioral pattern used elsewhere in the dashboard.Testing
frontend/src/components/trustlines/__tests__/AssetInsights.test.tsx(new — this component had no prior test coverage), following the existing convention fromdashboard/__tests__/RealtimeDashboardFallback.test.tsx. Covers: loading state, empty state (null data), empty state (data with no derivable sentences), and the happy-path sentence rendering.npx vitest run src/components/trustlines/__tests__/AssetInsights.test.tsx src/components/dashboard/__tests__/InsightsList.test.tsx→ 2 files, 10 tests, all passing.npx eslinton both changed/added files → no errors.Scope note
Corridors/anchors/governance don't have insight callouts built yet (no matching components exist in the tree), so this PR doesn't touch them — wiring those up is separate, follow-on work once those pages get their own insight data sources.
Closes #152
Closes #157