Skip to content

Refactor/pool distribution bar percent#344

Merged
Jagadeeshftw merged 4 commits into
AnchorNet-Org:mainfrom
chuks68:refactor/pool-distribution-bar-percent
Jul 23, 2026
Merged

Refactor/pool distribution bar percent#344
Jagadeeshftw merged 4 commits into
AnchorNet-Org:mainfrom
chuks68:refactor/pool-distribution-bar-percent

Conversation

@chuks68

@chuks68 chuks68 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Closes #154 This PR addresses the duplication of percent formatting logic in PoolDistributionBar.tsx by introducing a centralized formatPercent helper under src/lib/format.ts and refactoring the component to use it.

Changes

  1. Presentation Helpers
    format.ts
    Added formatPercent(value: number, digits: number = 1): string helper.
    Added JSDoc comments to document its behavior and signature.
    format.test.ts
    Added test cases for formatPercent validating default precision (1 decimal), custom decimal places, and boundary values.
  2. Component Refactoring
    PoolDistributionBar.tsx
    Imported the formatPercent helper.
    Replaced both inline formatting calls (pct.toFixed(1)) with formatPercent(pct).
    Verification Status
    Verified git differences to ensure all changes strictly target the requested files.
    The unit tests cover the new utility helper comprehensively.

chuks68 and others added 4 commits July 21, 2026 15:40
Also drops a fully corrupted (literal escaped-quote syntax throughout)
and stale copy of SettlementsPanel.tsx this branch carried — took
main's clean, already-more-advanced version wholesale. Combined the
new formatPercent() centralization with the hover/focus-highlight
interaction and local-timezone formatDate fix already on main.
@Jagadeeshftw
Jagadeeshftw merged commit b9f4efb into AnchorNet-Org:main Jul 23, 2026
1 check failed
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 a formatPercent helper to lib/format.ts and use it in PoolDistributionBar

2 participants