From 5b1222c16c02e25dfcb9f27217a78aacfd8052fc Mon Sep 17 00:00:00 2001 From: XueyuanPang-Google Date: Sun, 30 Aug 2026 22:56:05 +0800 Subject: [PATCH] fix(ui): use shared formatCurrency in StatCard to deduplicate currency formatting (fixes #261) --- src/components/ui/StatCard.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/components/ui/StatCard.tsx b/src/components/ui/StatCard.tsx index ee3b035..86ca2f5 100644 --- a/src/components/ui/StatCard.tsx +++ b/src/components/ui/StatCard.tsx @@ -22,7 +22,7 @@ * always available via the title attribute (keyboard-navigable, hover tooltip). */ -import { cn } from "@/lib/utils"; +import { cn, formatCurrency } from "@/lib/utils"; import { ArrowUpRight, ArrowDownRight, AlertCircle } from "lucide-react"; import type { LucideIcon } from "lucide-react"; import { Sparkline } from "./Sparkline"; @@ -79,10 +79,7 @@ function formatValue( switch (format) { case "currency": { const maxDecimals = asset === "XLM" ? 7 : 2; - const formatted = value.toLocaleString("en-US", { - maximumFractionDigits: maxDecimals, - }); - const display = `${formatted} ${asset}`; + const display = formatCurrency(value, asset); // Exact value for tooltip shows full asset-specific precision const exact = `${value.toLocaleString("en-US", { maximumFractionDigits: maxDecimals })} ${asset}`; return { display, exact };