From 531a5d77ea9cda878753eeb7a072cc9eb97b00d7 Mon Sep 17 00:00:00 2001 From: Aaron Imming Date: Fri, 31 May 2019 16:34:46 +0800 Subject: [PATCH] Show correct decimals for balance --- src/botPage/view/View.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/botPage/view/View.js b/src/botPage/view/View.js index d54b3df8ce..9dd37c1b1e 100644 --- a/src/botPage/view/View.js +++ b/src/botPage/view/View.js @@ -18,8 +18,8 @@ import Tour from './tour'; import TradeInfoPanel from './TradeInfoPanel'; import { showDialog } from '../bot/tools'; import Elevio from '../../common/elevio'; -import { updateConfigCurrencies } from '../common/const'; -import { roundBalance, isVirtual } from '../common/tools'; +import config, { updateConfigCurrencies } from '../common/const'; +import { isVirtual } from '../common/tools'; import { logoutAllTokens, getOAuthURL, @@ -66,8 +66,16 @@ api.events.on('balance', response => { balance: { balance: b, currency }, } = response; - const balance = (+roundBalance({ currency, balance: b })).toLocaleString(getLanguage().replace('_', '-')); - $('.topMenuBalance').text(`${balance} ${currency}`); + const elTopMenuBalances = document.querySelectorAll('.topMenuBalance'); + const localString = getLanguage().replace('_', '-'); + const balance = (+b).toLocaleString(localString, { + minimumFractionDigits: config.lists.CRYPTO_CURRENCIES.includes(currency) ? 8 : 2, + }); + + elTopMenuBalances.forEach(elTopMenuBalance => { + const element = elTopMenuBalance; + element.textContent = `${balance} ${currency}`; + }); }); const addBalanceForToken = token => {