feat: pool health score widget with trend indicators and suggestions - #245
Open
benzy018 wants to merge 2 commits into
Open
feat: pool health score widget with trend indicators and suggestions#245benzy018 wants to merge 2 commits into
benzy018 wants to merge 2 commits into
Conversation
Sendi0011
requested changes
Aug 22, 2026
Sendi0011
left a comment
Contributor
There was a problem hiding this comment.
Review: Pool Health Score Widget — CHANGES REQUESTED
Well-designed UI component with circular progress rings, trend indicators, and actionable suggestions. However, CI is failing (Playwright + Lint).
CI Failures (Must Fix)
- Playwright: Likely related to the new components not having proper mock data in E2E tests
- Lint/Format: Likely prettier formatting issues on new files
Architecture
lib/pool-health.ts— Health score computation engine (new)components/dashboard/pool-health-widget.tsx(390 lines) — Horizontal scrollable card grid with SVG circular rings, trend icons, grade badgescomponents/dashboard/health-suggestion-list.tsx(227 lines) — Expandable suggestion list sorted by urgency- Modified
my-groups.tsx— Integrates both widgets at the top of the dashboard
Code Quality
- Uses
getCachedPoolHealth()for memoized score computation - Proper framer-motion animations for card entrance and list expand/collapse
- SVG circular ring is well-implemented with
strokeDashoffsetanimation - Grade styles (A-F) use consistent color scheme (emerald/lime/amber/orange/rose)
- Proper ARIA attributes (
role="img",aria-label,aria-expanded,aria-controls)
Non-blocking Notes
poolToHealthInput()is duplicated between widget and suggestion list — could extract to shared utility- TVL trend is approximated (assumes flat 7-day history) since pool list API doesn't expose historical data
pool-health.tshealth scoring algorithm may overlap with the admin dashboard'scomputeHealthScorein PR #244 — worth consolidating later
Required Changes
- Fix Playwright failures — add mock data for pool health endpoints in test fixtures
- Fix lint/format issues — run
pnpm formaton new files - Consider extracting
poolToHealthInput()to a shared utility to avoid duplication
Implements the pool health score widget on the My Groups tab as described in issue JointSave-org#224. Changes: - frontend/lib/pool-health.ts: Add calculatePoolHealth() utility that computes a 0-100 composite score from depositCompliance, memberActivity, tvlTrend, deadlineProximity, and disputeCount factors. Includes grade mapping (A-F), trend detection (improving/stable/declining), suggestion engine, and a 5-minute client-side score cache. Existing computePoolHealth() (reputation system) is preserved unchanged. - frontend/components/dashboard/pool-health-widget.tsx: New PoolHealthWidget component. Renders a horizontal-scrollable row of per-pool health cards (circular SVG ring, letter grade, trend arrow, top suggestion, View Details link) plus an OverallHealthCard showing the average score. Includes skeleton loaders for the loading state. For users with >20 pools only the top-5 are shown with a 'View All' toggle. Widget is hidden when the user has no pools. - frontend/components/dashboard/health-suggestion-list.tsx: New HealthSuggestionList component. Expandable accordion below the health cards listing all suggestions across all pools, sorted by urgency (high → medium → low). Each row shows the suggestion, pool name, and an urgency badge. Animated expand/collapse via framer-motion. - frontend/components/dashboard/my-groups.tsx: Integrate PoolHealthWidget at the top of the My Groups tab, rendered above the search input when pools are present. Skeleton variant shown while data loads. - frontend/e2e/fixtures/mock-pools.ts: Add mock handler for /api/pools/:id/members so the health widget's member fetch resolves correctly in Playwright tests. All 168 existing unit tests pass. No TypeScript errors in modified files. Prettier formatting applied. Closes JointSave-org#224
benzy018
force-pushed
the
feat/pool-health-score-widget
branch
from
August 25, 2026 02:29
0134102 to
ef1b1a3
Compare
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
Implements the pool health score widget for the dashboard My Groups tab as described in issue #224.
Changes
frontend/lib/pool-health.tscalculatePoolHealth(pool, members, activities) → PoolHealthScorewith score (0–100), grade (A–F), factors, trend, and suggestionsPoolHealthScore,PoolHealthInput,HealthFactors,HealthGrade,HealthTrendgetCachedPoolHealth()— 5-minute client-side cache per poolcomputePoolHealth,PoolHealth, etc.) are unchangedfrontend/components/dashboard/pool-health-widget.tsx(new)frontend/components/dashboard/health-suggestion-list.tsx(new)frontend/components/dashboard/my-groups.tsxPoolHealthWidgetandHealthSuggestionListbelow the search bar, above the pool gridAcceptance criteria
Testing
pool-health.test.tsunit tests passCloses #224