Fix: comma and dot separators for nums in Dashboard footer and Funding (#587)

* Fix: comma and dot separators for nums in Dashboard footer and Funding

* Chore: remove unnecessary .decimalPlaces
This commit is contained in:
csrapr 2021-02-20 00:09:37 +00:00 committed by GitHub
parent c004ebb749
commit a5a869a734
4 changed files with 34 additions and 43 deletions

View file

@ -114,30 +114,28 @@ const SystemPerformance = () => {
}
const getFiatVolume = () =>
new BigNumber(R.sum(getFiats(transactionsToShow)))
.decimalPlaces(2)
.toNumber()
new BigNumber(R.sum(getFiats(transactionsToShow))).toFormat(2)
const getProfit = transactions => {
const cashInFees = R.sum(mapToFee(transactions))
const commissionFees = R.reduce(reducer, 0, transactions)
return new BigNumber(commissionFees + cashInFees)
.decimalPlaces(2)
.toNumber()
}
const getPercentChange = () => {
const thisTimePeriodProfit = getProfit(transactionsToShow)
const previousTimePeriodProfit = getProfit(transactionsLastTimePeriod)
const thisTimePeriodProfit = getProfit(transactionsToShow).toNumber()
const previousTimePeriodProfit = getProfit(
transactionsLastTimePeriod
).toNumber()
if (thisTimePeriodProfit === previousTimePeriodProfit) return 0
if (previousTimePeriodProfit === 0) return 100
return Math.round(
(100 * (thisTimePeriodProfit - previousTimePeriodProfit)) /
Math.abs(previousTimePeriodProfit)
)
return new BigNumber(
((thisTimePeriodProfit - previousTimePeriodProfit) * 100) /
previousTimePeriodProfit
).toFormat(2)
}
const getDirectionPercent = () => {
@ -207,7 +205,7 @@ const SystemPerformance = () => {
</Label2>
<div className={classes.profitContainer}>
<div className={classes.profitLabel}>
{`${getProfit(transactionsToShow)} ${
{`${getProfit(transactionsToShow).toFormat(2)} ${
data?.config.locale_fiatCurrency
}`}
</div>