Skip to content

feat(treasury): hookify treasury page with /api/treasury/stats + /api…#452

Merged
Anuoluwapo25 merged 2 commits intobakeronchain:mainfrom
Adeyemi-cmd:treasury_page
Mar 31, 2026
Merged

feat(treasury): hookify treasury page with /api/treasury/stats + /api…#452
Anuoluwapo25 merged 2 commits intobakeronchain:mainfrom
Adeyemi-cmd:treasury_page

Conversation

@Adeyemi-cmd
Copy link
Copy Markdown
Contributor

Close #258

PR: Treasury page integration with real backend data

Summary

Replace mock treasury values with live data from backend endpoints.

  • Added src/hooks/useTreasury.ts
    • Fetches:
      • GET /api/treasury/stats
      • GET /api/treasury/activity?limit=20
    • Exposes stats, activity, isLoading, isError, refetch
  • Updated src/pages/Treasury.tsx
    • Uses useTreasury()
    • Removed hardcoded values (125,400 USDC, 128 scholars, manual activity list)
    • Shows:
      • skeleton loaders while loading
      • error state when fetch fails
      • empty state when activity is []

Why

Current treasury page displays static mock data and does not reflect real on-chain / backend state. This PR makes the dashboard data-driven and aligned with backend contract events.

Testing

  1. Start backend + frontend.
  2. Load /treasury and verify:
    • stats card values are from API
    • activity feed contains API events
  3. Simulate slow API response:
    • skeleton appears
  4. Simulate empty activity:
    • empty state card appears
  5. Simulate API failure:
    • error box appears

Follow-up

  • Add tests for useTreasury hook and Treasury page states.
  • Consider Grafana/analytics section to show full historical inflow/outflow charts from API.

…/treasury/activity, add loading skeleton and empty state
@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 27, 2026

@Adeyemi-cmd Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Anuoluwapo25 Anuoluwapo25 merged commit 4c551b7 into bakeronchain:main Mar 31, 2026
2 of 6 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.

Treasury page: replace all hardcoded mock data with real API calls

2 participants