Skip to content

Derive dashboard statistics from typed services #48

Description

@Lakes41

Difficulty: Hard

Type: Refactor

Summary

Refactor dashboard overview statistics so they are derived from typed services rather than hard-coded or directly imported mock arrays.

Current Behaviour

The dashboard relies on mock data for passes, guilds, members, and activity. Statistics can drift from source data if each page computes values independently.

Expected Behaviour

Dashboard stats should come from a shared service that computes totals, active counts, recent activity, and trend-ready values consistently.

Suggested Implementation

Add a dashboard metrics service that consumes pass, guild, member, and activity repositories. Use it on the overview page and add tests for edge cases such as empty data, draft passes, inactive members, and failed activity fetches.

Files or Areas Likely Affected

  • apps/dashboard/app/dashboard/page.tsx
  • apps/dashboard/lib/data/
  • apps/dashboard/lib/metrics/
  • apps/dashboard/lib/mock-data.ts
  • apps/dashboard/test/

Acceptance Criteria

  • Dashboard stats are calculated through a shared metrics service
  • Draft and inactive records are counted intentionally
  • Empty datasets return safe zero values
  • Overview page no longer computes core metrics inline
  • Tests cover normal, empty, and mixed-status datasets
  • Metrics service can later consume live data without changing the page

Additional Notes

Assumption: current mock data remains the source for local development until live storage is introduced.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaign

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions