diff --git a/frontend/src/components/crypto/CryptoAllocationBody.tsx b/frontend/src/components/crypto/CryptoAllocationBody.tsx index 67dc3dc..73ff61e 100644 --- a/frontend/src/components/crypto/CryptoAllocationBody.tsx +++ b/frontend/src/components/crypto/CryptoAllocationBody.tsx @@ -1,4 +1,3 @@ -import { Bitcoin } from "lucide-react"; import { Cell, Pie, PieChart, ResponsiveContainer, Tooltip } from "recharts"; import { formatCurrency, maskAmount } from "@/lib/format"; import { useTranslation } from "@/lib/i18n"; @@ -31,7 +30,6 @@ interface Slice { key: string; name: string; symbol: string | null; - thumbUrl: string | null; amount: number; color: string; } @@ -39,7 +37,7 @@ interface Slice { function buildSlices(holdings: CryptoHolding[]): Slice[] { const priced = holdings .filter((h) => h.value !== null && Number(h.value) > 0) - .map((h) => ({ key: String(h.asset_id), name: h.name, symbol: h.symbol, thumbUrl: h.thumb_url, amount: Number(h.value) })) + .map((h) => ({ key: String(h.asset_id), name: h.name, symbol: h.symbol, amount: Number(h.value) })) .sort((a, b) => b.amount - a.amount); const top = priced.slice(0, MAX_SLICES).map((item, index) => ({ ...item, color: SERIES_COLORS[index] })); @@ -47,7 +45,7 @@ function buildSlices(holdings: CryptoHolding[]): Slice[] { if (rest.length === 0) return top; const otherTotal = rest.reduce((sum, item) => sum + item.amount, 0); - return [...top, { key: "other", name: "Other", symbol: null, thumbUrl: null, amount: otherTotal, color: OTHER_COLOR }]; + return [...top, { key: "other", name: "Other", symbol: null, amount: otherTotal, color: OTHER_COLOR }]; } function DonutTooltip({ @@ -73,11 +71,13 @@ function DonutTooltip({ ); } -/** The "Allocation" tab's content inside CryptoOverviewCard — a donut (part- - * to-whole across few categories is exactly the case a donut is fine for) - * plus a list that also carries the $ amount, which the donut/legend alone - * can't — the user explicitly wants both percent and sum per coin, not just - * percent the way CoinMarketCap's own version shows it. */ +/** The "Allocation" tab's content inside CryptoOverviewCard — a donut + * (part-to-whole across few categories is exactly the case a donut is fine + * for) plus a compact table: a color swatch identifying the ticker, its + * share, and the amount. A real
| + + + + {slice.key === "other" ? t("crypto.allocation.other") : slice.symbol} + + + | ++ {slice.percent.toFixed(1)}% + | +{maskAmount(formatCurrency(slice.amount), hidden)} | +