UI: Add settings to change currency symbol and whether to show it after money value (#2453)

This commit is contained in:
kaoticengineering
2026-01-28 14:16:28 -06:00
committed by GitHub
parent 366c44d5c2
commit afddd284fc
8 changed files with 52 additions and 18 deletions
+5 -2
View File
@@ -200,9 +200,12 @@ export const formatThreads = formatHp;
/** Display an integer up to 999,999,999 before collapsing to suffixed form with 3 fractional digits */
export const formatSkill = (n: number) => formatNumber(n, 3, 1e9, true);
/** Display standard money formatting, including the preceding $. */
/** Display standard money formatting, including the currency symbol. */
export const formatMoney = (n: number, useExponentialFormForSmallValue = false): string => {
return `$${!useExponentialFormForSmallValue || n === 0 || n >= 0.001 ? formatNumber(n) : n.toExponential(3)}`;
const value = !useExponentialFormForSmallValue || n === 0 || n >= 0.001 ? formatNumber(n) : n.toExponential(3);
return Settings.CurrencySymbolAfterValue
? `${value}${Settings.CurrencySymbol}`
: `${Settings.CurrencySymbol}${value}`;
};
/** Display a decimal number with increased precision (5 fractional digits) */