Skip to content

feat: add TVL/balance trend sparkline to pool cards#177

Merged
Sendi0011 merged 2 commits into
JointSave-org:mainfrom
Yerimahjr:feat/pool-card-trend-sparkline
Jul 21, 2026
Merged

feat: add TVL/balance trend sparkline to pool cards#177
Sendi0011 merged 2 commits into
JointSave-org:mainfrom
Yerimahjr:feat/pool-card-trend-sparkline

Conversation

@Yerimahjr

Copy link
Copy Markdown

Closes #142

What this does

  • Adds a pool-daily-metrics snapshot writer (/api/cron/snapshot-pool-metrics), triggered daily via Vercel Cron (see vercel.json)
  • Adds a batched read endpoint (/api/pools/history) so the Explore/My Groups grid fetches history for all visible pools in one request instead of one per card
  • Adds PoolSparkline, a lightweight inline SVG (no new charting dependency), showing the last 30 days of balance history
  • Wires it into pool-card.tsx next to the "Total Saved" value

Why no new table/migration

pool_daily_metrics already existed (added in 20260616080000_analytics_schema.sql) and was already being read in /api/analytics, but nothing was writing to it — this PR fills that gap rather than introducing a duplicate table.

Degradation behavior

PoolSparkline returns null for pools with fewer than 2 data points, so new/empty pools just show no sparkline rather than a broken or misleading chart.

Verification

NEXT_PUBLIC_SUPABASE_URL isn't available in my local env, so a full next build isn't possible here — verified instead via tsc --noEmit (no new errors introduced; 14 pre-existing errors in unrelated files remain unchanged) and eslint (clean) on all changed/added files.

Setup needed after merge

A CRON_SECRET env var needs to be added in Vercel project settings for the cron auth check to pass in production.

@Sendi0011
Sendi0011 self-requested a review July 21, 2026 16:16

@Sendi0011 Sendi0011 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.

Great Implementation @Yerimahjr

@Sendi0011
Sendi0011 merged commit 48a05f2 into JointSave-org:main Jul 21, 2026
4 checks 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.

[Feature] Add TVL/balance trend sparkline to pool cards

3 participants