Skip to content

feat(profile): contributor stats dashboard (#836)#1234

Open
aunysillyme wants to merge 1 commit into
SolFoundry:mainfrom
aunysillyme:ai/836-contributor-stats-dashboard
Open

feat(profile): contributor stats dashboard (#836)#1234
aunysillyme wants to merge 1 commit into
SolFoundry:mainfrom
aunysillyme:ai/836-contributor-stats-dashboard

Conversation

@aunysillyme
Copy link
Copy Markdown

/claim #836

⚠️ This PR is AI-assisted. It was implemented end-to-end by Claude (Anthropic) at the request of the bounty hunter. Please review the diff carefully before merging.

Summary

Builds the Contributor Profile Stats Dashboard described in #836. The profile page now leads with a stats dashboard — visible before the existing tabbed area — that pulls together GitHub activity, FNDRY/USDC earnings history, and headline contributor metrics.

What landed

  • GitHub activity heatmap (GitHubActivityGraph) — last 90 days of public events from api.github.com/users/{username}/events/public, rendered as a GitHub-style daily heatmap (SVG, no extra deps) with a per-event-type breakdown (commits, PRs, issues, reviews).
  • Earnings history chart (EarningsHistoryChart) — stacked monthly bar chart of USDC + FNDRY payouts (recharts), with a 6mo / 12mo range toggle, built from the contributor's approved submissions joined against their bounty rewards.
  • Key stats row (StatsRow) — total earned (USDC + FNDRY), bounties completed, current / longest contribution streak (derived from the GitHub event stream), and rolling event count.
  • /api/users/me/submissions client + useMySubmissions hook — graceful 404/501 fallback so the panel renders an empty-but-useful state until the backend ships that endpoint.

Drive-by fix

The repo-wide .gitignore had a lib/ rule (intended for Python venvs) that was silently catching frontend/src/lib/. The lib/utils and lib/animations modules were referenced across ~20 frontend files but had never been committed — tsc and vite build both failed on main before this PR. The ignore is narrowed to venv paths and the two missing modules are now tracked.

Files

  • frontend/src/api/github.ts + hooks/useGitHubActivity.ts — GitHub events fetcher with weight-by-commit-count and streak math
  • frontend/src/components/profile/{ContributorStatsPanel,GitHubActivityGraph,EarningsHistoryChart,StatsRow}.tsx
  • frontend/src/api/bounties.ts + hooks/useBounties.ts — new listMySubmissions / useMySubmissions with 404 fallback
  • frontend/src/components/profile/ProfileDashboard.tsx — wires the new panel into the existing dashboard
  • frontend/src/lib/{utils,animations}.ts — restored shared helpers (formatCurrency / timeAgo / animation variants)
  • frontend/src/__tests__/{github-activity,utils}.test.ts — 12 new passing unit tests covering event aggregation, streak computation, and number/date formatting
  • .gitignore — narrow the Python lib/ ignore so it doesn't swallow the frontend lib folder

Test plan

  • npx tsc --noEmit — clean
  • npx vite build — succeeds (previously failed on main because of the missing lib/ modules)
  • npx vitest run src/__tests__/github-activity.test.ts src/__tests__/utils.test.ts — 12/12 pass
  • Dev server (npx vite) boots and serves the profile page without runtime errors
  • Manual smoke test against a real GitHub account (recommend reviewer try their own username — the heatmap is hydrated client-side from the public events API, no token required)

Acceptance criteria mapping

  • ✅ GitHub activity graph (commits, PRs, issues) via GitHub API → GitHubActivityGraph + api/github.ts
  • ✅ Earning history chart showing FNDRY payouts over time → EarningsHistoryChart (stacked USDC + FNDRY)
  • ✅ Key stats: total earned, bounties completed, contribution streak → StatsRow

Notes for reviewers

  • The GitHub public events feed only returns ~90 days of data and is unauthenticated, so it has a 60 req/hr per-IP rate limit. The query is cached in React Query for 5 minutes per username, so the typical session stays well under that.
  • Earnings rely on /api/users/me/submissions returning approved submissions. The frontend handles a missing endpoint gracefully (empty state); the panel will light up automatically once the backend exposes it.

🤖 Generated with Claude Code

Builds the contributor profile stats dashboard requested in SolFoundry#836:

- GitHub activity heatmap (last 90 days) sourced from the public GitHub
  events API, plus a per-type breakdown (commits, PRs, issues, reviews).
- Earnings history chart with stacked USDC + FNDRY payouts and a
  6mo / 12mo range toggle.
- Key stats row: total earned (USDC + FNDRY), bounties completed,
  current/longest contribution streak, and rolling event count.
- New /api/users/me/submissions client with a graceful 404 fallback so
  the panel renders sensibly until the backend ships that endpoint.

Also restores the frontend `lib/utils` + `lib/animations` modules that
were referenced across the codebase but never committed (the repo-wide
`lib/` ignore was catching `frontend/src/lib`); the ignore is now
narrowed to Python venv paths.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

missing-wallet PR is missing a Solana wallet for bounty payout

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant