From f202f5aea72ef611861c917fd3662e9972d20ce5 Mon Sep 17 00:00:00 2001 From: Mohsen Date: Wed, 27 Nov 2024 22:27:59 +0300 Subject: [PATCH] [#21644] fix: display zero for empty balances asset --- src/status_im/contexts/wallet/common/utils.cljs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/status_im/contexts/wallet/common/utils.cljs b/src/status_im/contexts/wallet/common/utils.cljs index 2eaedf60947..d047e4615cc 100644 --- a/src/status_im/contexts/wallet/common/utils.cljs +++ b/src/status_im/contexts/wallet/common/utils.cljs @@ -264,6 +264,13 @@ (str $ address)) address)) +(defn asset-fiat-formatted-for-ui + [currency-symbol fiat-value] + (cond + (money/equal-to fiat-value 0) (str currency-symbol "0.00") + (money/less-than fiat-value 0.01) (str "<" currency-symbol "0.01") + :else (prettify-balance currency-symbol fiat-value))) + (defn fiat-formatted-for-ui [currency-symbol fiat-value] (if (money/less-than fiat-value 0.01) @@ -294,8 +301,8 @@ formatted-token-price (prettify-balance currency-symbol price) percentage-change (prettify-percentage-change change-pct-24h) crypto-value (get-standard-crypto-format token balance prices-per-token) - fiat-value (fiat-formatted-for-ui currency-symbol - fiat-unformatted-value)] + fiat-value (asset-fiat-formatted-for-ui currency-symbol + fiat-unformatted-value)] {:token (:symbol token) :token-name (:name token) :state :default