fix sorting
This commit is contained in:
parent
a13975f3f6
commit
db6a014bbd
|
@ -177,7 +177,7 @@
|
|||
"This function returns token values in the props of token-value (quo) component"
|
||||
[{:keys [token color currency currency-symbol]}]
|
||||
(let [balance (calculate-total-token-balance token)
|
||||
fiat-value (calculate-token-fiat-value
|
||||
fiat-unformatted-value (calculate-token-fiat-value
|
||||
{:currency currency
|
||||
:balance balance
|
||||
:token token})
|
||||
|
@ -191,7 +191,7 @@
|
|||
crypto-value (get-standard-crypto-format token balance)
|
||||
fiat-value (get-standard-fiat-format crypto-value
|
||||
currency-symbol
|
||||
fiat-value)]
|
||||
fiat-unformatted-value)]
|
||||
{:token (:symbol token)
|
||||
:token-name (:name token)
|
||||
:state :default
|
||||
|
@ -203,6 +203,7 @@
|
|||
:customization-color color
|
||||
:values {:crypto-value crypto-value
|
||||
:fiat-value fiat-value
|
||||
:fiat-unformatted-value fiat-unformatted-value
|
||||
:fiat-change formatted-token-price
|
||||
:percentage-change percentage-change}}))
|
||||
|
||||
|
|
|
@ -496,11 +496,13 @@
|
|||
:<- [:profile/currency]
|
||||
:<- [:profile/currency-symbol]
|
||||
(fn [[{:keys [color]} tokens currency currency-symbol]]
|
||||
(mapv #(utils/calculate-token-value {:token %
|
||||
(let [calculated-tokens (mapv #(utils/calculate-token-value {:token %
|
||||
:color color
|
||||
:currency currency
|
||||
:currency-symbol currency-symbol})
|
||||
tokens)))
|
||||
tokens)]
|
||||
(vec (sort-by #(get-in % [:values :fiat-unformatted-value]) > calculated-tokens)))))
|
||||
|
||||
|
||||
(rf/reg-sub
|
||||
:wallet/aggregated-tokens
|
||||
|
@ -524,14 +526,17 @@
|
|||
(fn [[aggregated-tokens color currency currency-symbol]]
|
||||
(let [balance (utils/calculate-balance-from-tokens {:currency currency
|
||||
:tokens aggregated-tokens})
|
||||
formatted-balance (utils/prettify-balance currency-symbol balance)]
|
||||
{:balance balance
|
||||
:formatted-balance formatted-balance
|
||||
:tokens (mapv #(utils/calculate-token-value {:token %
|
||||
formatted-balance (utils/prettify-balance currency-symbol balance)
|
||||
token-values (mapv #(utils/calculate-token-value {:token %
|
||||
:color color
|
||||
:currency currency
|
||||
:currency-symbol currency-symbol})
|
||||
aggregated-tokens)})))
|
||||
aggregated-tokens)
|
||||
sorted-token-values (sort-by #(-> % :values :fiat-unformatted-value) > token-values)]
|
||||
{:balance balance
|
||||
:formatted-balance formatted-balance
|
||||
:tokens sorted-token-values})))
|
||||
|
||||
|
||||
(rf/reg-sub
|
||||
:wallet/network-preference-details
|
||||
|
|
Loading…
Reference in New Issue