Skip to content

Use the shared formatStroops and formatNumber helpers on the stats page #67

Description

@mikewheeleer

Wire the unused format helpers into the stats display

Description

src/lib/format.ts exports formatStroops, formatNumber, and formatTime, with unit tests in src/lib/__tests__/format.test.ts — but no page imports them. Meanwhile src/app/stats/page.tsx renders {stats.totalPairs} as a raw number with no thousands separators. This issue puts the shared formatters to use so large counts and any stroop amounts read correctly.

Requirements and context

  • Repository scope: StableRoute-Org/Stableroute-frontend only.
  • Render stats.totalPairs through formatNumber so counts get locale thousands separators.
  • If/when the stats payload exposes a stroop-denominated value, format it via formatStroops; otherwise document the helper as ready for that field.
  • Reuse src/components/StatTile.tsx for the tiles (currently the page hand-rolls dl/div markup) so formatting and layout are centralized.
  • Do not change the Stats type semantics or the fetch endpoint.

Suggested execution

Test and commit

  • Run npm run lint, npm test, and npm run build.
  • Cover edge cases: small count, large count (with separators), and zero.
  • Include the full npm test output in the PR description.

Example commit message

refactor: render stats through shared format helpers and StatTile

Guidelines

  • Minimum 95 percent test coverage for impacted modules.
  • Clear, reviewer-focused documentation.
  • Timeframe: 96 hours.

Community & contribution rewards

  • 💬 Join the StableRoute community on Discord for questions, reviews, and faster merges: https://discord.gg/37aCpusvx
  • ⭐ This is a GrantFox OSS / Official Campaign task and may be rewarded. When your PR is merged you'll be prompted to rate the project — if this issue and the maintainers helped you ship, we'd be grateful for a 5-star rating. Clear questions in Discord and tidy, well-tested PRs are the fastest path to a merge and a reward.

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions