Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Commit 531a5d7

Browse files
author
Aaron Imming
committed
Show correct decimals for balance
1 parent 99c950d commit 531a5d7

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/botPage/view/View.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import Tour from './tour';
1818
import TradeInfoPanel from './TradeInfoPanel';
1919
import { showDialog } from '../bot/tools';
2020
import Elevio from '../../common/elevio';
21-
import { updateConfigCurrencies } from '../common/const';
22-
import { roundBalance, isVirtual } from '../common/tools';
21+
import config, { updateConfigCurrencies } from '../common/const';
22+
import { isVirtual } from '../common/tools';
2323
import {
2424
logoutAllTokens,
2525
getOAuthURL,
@@ -66,8 +66,16 @@ api.events.on('balance', response => {
6666
balance: { balance: b, currency },
6767
} = response;
6868

69-
const balance = (+roundBalance({ currency, balance: b })).toLocaleString(getLanguage().replace('_', '-'));
70-
$('.topMenuBalance').text(`${balance} ${currency}`);
69+
const elTopMenuBalances = document.querySelectorAll('.topMenuBalance');
70+
const localString = getLanguage().replace('_', '-');
71+
const balance = (+b).toLocaleString(localString, {
72+
minimumFractionDigits: config.lists.CRYPTO_CURRENCIES.includes(currency) ? 8 : 2,
73+
});
74+
75+
elTopMenuBalances.forEach(elTopMenuBalance => {
76+
const element = elTopMenuBalance;
77+
element.textContent = `${balance} ${currency}`;
78+
});
7179
});
7280

7381
const addBalanceForToken = token => {

0 commit comments

Comments
 (0)