fix: "hide balance" on Crypto tab only masked the chart's header number

The eye toggle lived as local state inside CryptoHistoryChart, so it only
masked the big total figure — the holdings table, allocation card, and
stats tiles below stayed fully visible. Lifted `hidden` to CryptoPage and
threaded it through every money-displaying section (chart, stats row,
allocation list, holdings table, trade history modal) via a shared
maskAmount() helper.

Percentages (1h/24h/7d%, profit/loss %) stay visible on purpose — a
relative change doesn't reveal the actual amount of money involved, only
absolute currency figures and coin quantities (which combined with a
visible price also reveal an amount) are masked.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01855PiW5Wd8n4aRW4n9kByY
This commit is contained in:
ZProger
2026-08-30 04:43:30 +03:00
parent 4ea83a9cda
commit 5f34d0a612
7 changed files with 80 additions and 35 deletions

View File

@@ -23,6 +23,15 @@ export function formatSignedCurrency(amount: number | string, currency: string =
return `${sign}${formatCurrency(value, currency)}`;
}
/** "Hide balance" masking — wraps an already-formatted amount (currency,
* quantity, whatever reveals a dollar figure) rather than reformatting it,
* so call sites don't need a separate hidden-vs-shown branch for every
* number. Percentages are deliberately never masked by callers — a % move
* doesn't reveal how much money is actually involved. */
export function maskAmount(formatted: string, hidden: boolean): string {
return hidden ? "••••" : formatted;
}
const MONTH_LABELS_EN = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] as const;
const MONTH_LABELS_RU = ["Янв", "Фев", "Мар", "Апр", "Май", "Июн", "Июл", "Авг", "Сен", "Окт", "Ноя", "Дек"] as const;