feat(ui): add dynamic amount currency prefix, normalize fiat symbols, and simplify data source badge

This commit is contained in:
2026-03-09 14:41:52 +01:00
parent 3fff234938
commit 9511ba94b1
3 changed files with 155 additions and 73 deletions

38
lib/currency-display.ts Normal file
View File

@@ -0,0 +1,38 @@
import { AssetType } from "@/lib/assets";
interface DisplayAsset {
code: string;
type: AssetType;
symbol?: string;
}
const FIAT_DISPLAY_SYMBOLS: Record<string, string> = {
USD: "$",
EUR: "€",
GBP: "£",
JPY: "¥",
PLN: "zł",
CHF: "CHF",
CAD: "C$",
AUD: "A$",
NZD: "NZ$",
CNY: "¥",
INR: "₹",
KRW: "₩",
TRY: "₺",
BRL: "R$",
MXN: "MX$",
THB: "฿"
};
export function getDisplaySymbol(asset?: DisplayAsset): string | undefined {
if (!asset) {
return undefined;
}
if (asset.type === "fiat") {
return FIAT_DISPLAY_SYMBOLS[asset.code] ?? asset.symbol ?? asset.code;
}
return asset.symbol ?? asset.code;
}