Skip to content

feat: add PlatformStats component with usePlatformStats hook and getCreditVelocity#55

Open
Yasir-TechGuy wants to merge 2 commits into
SmartDropLabs:mainfrom
Yasir-TechGuy:main
Open

feat: add PlatformStats component with usePlatformStats hook and getCreditVelocity#55
Yasir-TechGuy wants to merge 2 commits into
SmartDropLabs:mainfrom
Yasir-TechGuy:main

Conversation

@Yasir-TechGuy

@Yasir-TechGuy Yasir-TechGuy commented Jun 24, 2026

Copy link
Copy Markdown

Summary

Implements the PlatformStats section showing platform health metrics above the pool list on the farm page.

Changes

  • src/lib/soroban.ts — Added getCreditVelocity(windowHours: 24) as a method on SorobanService class
  • src/hooks/useSorobanQuery.ts — Added usePlatformStats hook with staleTime: 60000, refetch every 2 minutes
  • src/components/PlatformStats/PlatformStats.tsx — New component with four stat cards (TVL, Active Pools, Total Farmers, 24h Credit Velocity)
  • src/app/farm/page.tsx — Integrated PlatformStats with server-side pre-rendering
  • src/lib/soroban.history.test.ts — Fixed invalid Stellar addresses

Acceptance Criteria Met

  • usePlatformStats hook with staleTime: 60000, refetch every 2 minutes
  • <PlatformStats> with four <Stat> cards using Chakra StatNumber/StatLabel
  • ✅ TVL formatted with formatCredits showing asset code ("42.3M XLM")
  • ✅ Farmer count uses locale-aware toLocaleString()
  • getCreditVelocity(windowHours: 24) method on SorobanService
  • ✅ Skeleton loading states for each stat card
  • ✅ Server-side pre-rendered with initial data in farm/page.tsx
  • ✅ Vitest snapshot test passing (47/47 tests pass)

closes #33

Yasir Abdulsalam added 2 commits June 24, 2026 21:14
…reditVelocity

- Add getCreditVelocity method to SorobanService class
- Add usePlatformStats hook with staleTime 60s, refetch every 2 minutes
- Add PlatformStats component with TVL, Active Pools, Total Farmers, 24h Credit Velocity
- Add Skeleton loading states for each stat card
- Pre-render stats server-side in farm/page.tsx via getPreRenderedStats()
- Add Vitest snapshot test for PlatformStats component
- Fix invalid Stellar addresses in soroban.history.test.ts
@Yasir-TechGuy

Copy link
Copy Markdown
Author

Hi @prodbycorne Please check it out.

@Yasir-TechGuy

Copy link
Copy Markdown
Author

Hi @prodbycorne , Please approve the workflow.

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.

Add platform statistics dashboard — TVL, total farmers, active pools, credit velocity

1 participant