Format and round the USD value of balances
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>{{balance.token.symbol}}</th>
|
<th>{{balance.token.symbol}}</th>
|
||||||
<td class="amount">{{fmt-crypto-currency balance.balance balance.token.symbol}}</td>
|
<td class="amount">{{fmt-crypto-currency balance.balance balance.token.symbol}}</td>
|
||||||
<td class="fiat-amount">{{balance.balanceUsd}} USD</td>
|
<td class="fiat-amount">~{{balance.balanceUsd}} USD</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import Service from '@ember/service';
|
import Service from '@ember/service';
|
||||||
import { tracked } from '@glimmer/tracking';
|
import { tracked } from '@glimmer/tracking';
|
||||||
import { A } from '@ember/array';
|
import { A } from '@ember/array';
|
||||||
import { timeout } from 'ember-concurrency';
|
|
||||||
import { task } from 'ember-concurrency-decorators';
|
import { task } from 'ember-concurrency-decorators';
|
||||||
import config from 'kredits-web/config/environment';
|
import config from 'kredits-web/config/environment';
|
||||||
|
|
||||||
@@ -25,6 +24,10 @@ export default class CommunityFundsService extends Service {
|
|||||||
|
|
||||||
processBalances (res) {
|
processBalances (res) {
|
||||||
for (const balance of res) {
|
for (const balance of res) {
|
||||||
|
// Format and round the approximate USD value
|
||||||
|
const lang = navigator.language || navigator.userLanguage;
|
||||||
|
balance.balanceUsd = Math.round(balance.balanceUsd).toLocaleString(lang);
|
||||||
|
|
||||||
if (balance.token) {
|
if (balance.token) {
|
||||||
// ERC20 token, has all meta data
|
// ERC20 token, has all meta data
|
||||||
this.balances.pushObject(balance);
|
this.balances.pushObject(balance);
|
||||||
|
|||||||
Reference in New Issue
Block a user