Skip to content

Add Analytics page with protocol KPIs, revenue chart, and gauges#13

Open
WilliamPyke wants to merge 9 commits intomainfrom
worktree-analytics-page
Open

Add Analytics page with protocol KPIs, revenue chart, and gauges#13
WilliamPyke wants to merge 9 commits intomainfrom
worktree-analytics-page

Conversation

@WilliamPyke
Copy link
Copy Markdown
Collaborator

New /analytics route with five sections: KPI cards (TVL, locked BTC, epoch fees, voting power), historical protocol revenue bar chart from Supabase gauge_history, sortable/searchable gauges table, liquidity pools table with graceful earn-api fallback, and earning power area chart. Includes two new edge API routes, three data-fetching hooks using React Query, and a nav link in the header.

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 15, 2026

Deploy Preview for matchb0x ready!

Name Link
🔨 Latest commit 4f31cd6
🔍 Latest deploy log https://app.netlify.com/projects/matchb0x/deploys/69e84cb2b09aad00087f253c
😎 Deploy Preview https://deploy-preview-13--matchb0x.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

New /analytics route with five sections: KPI cards (TVL, locked BTC,
epoch fees, voting power), historical protocol revenue bar chart from
Supabase gauge_history, sortable/searchable gauges table, liquidity
pools table with graceful earn-api fallback, and earning power area
chart. Includes two new edge API routes, three data-fetching hooks
using React Query, and a nav link in the header.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@WilliamPyke WilliamPyke force-pushed the worktree-analytics-page branch from ea65a1f to e51d5c3 Compare April 21, 2026 14:19
WilliamPyke and others added 8 commits April 21, 2026 10:25
Regenerates the lockfile so CI's frozen-lockfile install succeeds
after adding recharts to apps/webapp/package.json.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Next.js strict build flags payload[0].payload as possibly undefined
under noUncheckedIndexedAccess. Narrow the first entry explicitly
before reading .payload so both analytics tooltips type-check.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Skeleton from @mezo-org/mezo-clay requires the animation prop; other
pages (Dashboard, Incentives, Boost) already pass it. Add it to all
seven Skeleton usages across the analytics components so the Next.js
type-check during build succeeds.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
tsconfig has exactOptionalPropertyTypes enabled, so sublabel?: string
rejects the ternary 'kpis.btcPrice ? "@ $..." : undefined' expression
passed from the BTC card. Widen sublabel and isLoading to include
| undefined so explicit undefined is accepted.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The Tag component's color prop only accepts blue/brown/gray/green/
purple/red/yellow. Use yellow as the accent for concentrated pools
so the build type-checks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The Tag component from @mezo-org/mezo-clay exposes closeable, not
kind. Match the pattern used in GaugeCard and LockCarouselSelector by
passing closeable={false} on all three pool-type Tags.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The gauge_history table is untyped in the generated Supabase types, so
Supabase infers SelectQueryError for the select() result. Route the
cast through unknown (as the compiler suggests) so the assertion to
GaugeHistoryRow[] type-checks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Introduces a new AnalyticsGaugeVotes section that surfaces per-gauge
veBTC/veMEZO vote allocations across every registered gauge (LP pools,
MUSD/BTC, MUSD Savings Rate, etc.) so voters can compare relative
weight at a glance.

- New edge API /api/analytics/gauge-votes-by-epoch reads per-gauge
  rows from gauge_history for the last N epochs and returns both
  vebtc_weight and vemezo_weight per gauge per epoch.
- New useGaugeVotesByEpoch hook wraps the endpoint with the
  LONG_CACHE React Query profile.
- New AnalyticsGaugeVotes component adds:
  * Toggle between veBTC and veMEZO vote basis
  * Epoch selector (prev/next buttons + inline chip strip) for
    time-travel across the last 12 epochs
  * Per-gauge percentage bars with delta-vs-previous-epoch column
  * "new" / "dropped" tags for gauges entering/leaving the set
  * KPI strip with total weight, active gauges, epoch incentives,
    and top gauge share
- gauge-history-aggregate now also aggregates vebtc_weight per epoch
  so downstream charts can pivot on BTC-backed vote totals.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.

1 participant