Skip to content

[#1057] Fix airdrop chart diamond label clipping + MCap caption float#1058

Merged
realproject7 merged 1 commit intomainfrom
task/1057-chart-label-clipping
May 6, 2026
Merged

[#1057] Fix airdrop chart diamond label clipping + MCap caption float#1058
realproject7 merged 1 commit intomainfrom
task/1057-chart-label-clipping

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Fixes #1057

Summary

Two visible bugs from #1056:

  1. Diamond milestone labels clipped: `unlocks 100%` rendered as `unlocks 1`, `(≈ Fix Farcaster identity: use Steemhunt API (free) with Neynar fallback #250)` rendered as `(≈ [P0-2] Supabase Schema #2`, because text-anchor="middle" centered at x=584 (= pad.left + 1.0×chartW) extends ~35px past the SVG `viewBox`'s right edge. Fixed by widening `pad.right` from 16 to 50 (and `pad.left` 16 → 24 for symmetry, so `$0` endpoint label has room).

  2. Current MCap caption showed raw float: `$33.523555869999996K`. Fixed by adding `.toFixed(2)` rounding inside `formatMcap` for non-integer K/M values, while keeping integer milestone values ($1M, $10M, etc.) clean as `$1M` not `$1.00M`.

Files

  • src/components/airdrop/CampaignHero.tsxformatMcap rounding + pad adjustment in MCapChart
  • package.json — 1.7.0 → 1.7.1

Verification

  • npm run typecheck passes
  • formatMcap(1_000_000)\$1M (integer untouched)
  • formatMcap(33_523.555)\$33.52K
  • formatMcap(50)\$50
  • Diamond label at new x = 24 + 526 = 550, "unlocks 100%" centered = spans ≈515–585, fits inside viewBox (0–600)

Test plan

- pad.right 16 → 50 so the rightmost milestone (diamond) labels at
  text-anchor="middle" no longer extend past viewBox 600. pad.left 16
  → 24 so the "$0" endpoint label has matching breathing room.
- formatMcap rounds K/M values to 2 decimals when not integer, so
  "Current: $33.523555869999996K" renders as "$33.52K".

Fixes #1057

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
plotlink Ignored Ignored May 6, 2026 2:03am

Request Review

@realproject7 realproject7 merged commit d4956cd into main May 6, 2026
4 checks passed
@realproject7 realproject7 deleted the task/1057-chart-label-clipping branch May 6, 2026 02:13
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.

Airdrop chart: fix diamond label clipping and MCap caption float formatting

1 participant