From 3e0c0ed8760c3245100be84a6089afd3a627ddbf Mon Sep 17 00:00:00 2001 From: "soroush.asadi" Date: Sun, 7 Jun 2026 06:57:45 +0330 Subject: [PATCH] =?UTF-8?q?fix(topbar):=20coin=20balance=20was=20clipped?= =?UTF-8?q?=20=E2=80=94=20compact=20large=20numbers=20+=20shrink=20bar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Home top bar overflowed on narrow screens; in RTL the coins pill is the far-left item so its leading digits got clipped (showed "04,240" for 104,240). - CoinsPill: compact big balances (104,240 → 104K, 1.2M), shrink-0 + whitespace-nowrap; exact value in the tooltip. - TopBar: tighter gaps, profile pill min-w-0 (shrinks/truncates first), icon+coins group shrink-0 so it never gets squeezed. Verified: tsc + next build clean; web rebuilt on :1500. Co-Authored-By: Claude Opus 4.8 --- src/components/online/CoinsPill.tsx | 13 ++++++++++--- src/components/online/TopBar.tsx | 12 ++++++------ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/components/online/CoinsPill.tsx b/src/components/online/CoinsPill.tsx index b79f028..3a24bc9 100644 --- a/src/components/online/CoinsPill.tsx +++ b/src/components/online/CoinsPill.tsx @@ -6,6 +6,13 @@ import { useUIStore } from "@/lib/ui-store"; import { useI18n } from "@/lib/i18n"; import { cn } from "@/lib/cn"; +/** Compact balance so big numbers don't overflow tight headers (104,240 → 104K). */ +function fmtCoins(n: number): string { + if (n < 10_000) return n.toLocaleString(); + if (n < 1_000_000) return `${(n / 1000).toFixed(n < 100_000 ? 1 : 0)}K`.replace(".0K", "K"); + return `${(n / 1_000_000).toFixed(1)}M`.replace(".0M", "M"); +} + /** * The coin balance, as a button that opens the buy-coins store. Use it anywhere * coins are shown so tapping the balance always leads to topping up. @@ -17,15 +24,15 @@ export function CoinsPill({ className }: { className?: string }) { return ( -
+