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"
|
"This function returns token values in the props of token-value (quo) component"
|
||||||
[{:keys [token color currency currency-symbol]}]
|
[{:keys [token color currency currency-symbol]}]
|
||||||
(let [balance (calculate-total-token-balance token)
|
(let [balance (calculate-total-token-balance token)
|
||||||
fiat-value (calculate-token-fiat-value
|
fiat-unformatted-value (calculate-token-fiat-value
|
||||||
{:currency currency
|
{:currency currency
|
||||||
:balance balance
|
:balance balance
|
||||||
:token token})
|
:token token})
|
||||||
|
@ -191,7 +191,7 @@
|
||||||
crypto-value (get-standard-crypto-format token balance)
|
crypto-value (get-standard-crypto-format token balance)
|
||||||
fiat-value (get-standard-fiat-format crypto-value
|
fiat-value (get-standard-fiat-format crypto-value
|
||||||
currency-symbol
|
currency-symbol
|
||||||
fiat-value)]
|
fiat-unformatted-value)]
|
||||||
{:token (:symbol token)
|
{:token (:symbol token)
|
||||||
:token-name (:name token)
|
:token-name (:name token)
|
||||||
:state :default
|
:state :default
|
||||||
|
@ -203,6 +203,7 @@
|
||||||
:customization-color color
|
:customization-color color
|
||||||
:values {:crypto-value crypto-value
|
:values {:crypto-value crypto-value
|
||||||
:fiat-value fiat-value
|
:fiat-value fiat-value
|
||||||
|
:fiat-unformatted-value fiat-unformatted-value
|
||||||
:fiat-change formatted-token-price
|
:fiat-change formatted-token-price
|
||||||
:percentage-change percentage-change}}))
|
:percentage-change percentage-change}}))
|
||||||
|
|
||||||
|
|
|
@ -490,17 +490,19 @@
|
||||||
(get-in ui [:account-page :active-tab])))
|
(get-in ui [:account-page :active-tab])))
|
||||||
|
|
||||||
(rf/reg-sub
|
(rf/reg-sub
|
||||||
:wallet/current-viewing-account-token-values
|
:wallet/current-viewing-account-token-values
|
||||||
:<- [:wallet/current-viewing-account]
|
:<- [:wallet/current-viewing-account]
|
||||||
:<- [:wallet/current-viewing-account-tokens-in-selected-networks]
|
:<- [:wallet/current-viewing-account-tokens-in-selected-networks]
|
||||||
:<- [:profile/currency]
|
:<- [:profile/currency]
|
||||||
:<- [:profile/currency-symbol]
|
:<- [:profile/currency-symbol]
|
||||||
(fn [[{:keys [color]} tokens currency 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
|
:color color
|
||||||
:currency currency
|
:currency currency
|
||||||
:currency-symbol currency-symbol})
|
:currency-symbol currency-symbol})
|
||||||
tokens)))
|
tokens)]
|
||||||
|
(vec (sort-by #(get-in % [:values :fiat-unformatted-value]) > calculated-tokens)))))
|
||||||
|
|
||||||
|
|
||||||
(rf/reg-sub
|
(rf/reg-sub
|
||||||
:wallet/aggregated-tokens
|
:wallet/aggregated-tokens
|
||||||
|
@ -516,22 +518,25 @@
|
||||||
(utils/filter-tokens-in-chains aggregated-tokens chain-ids)))
|
(utils/filter-tokens-in-chains aggregated-tokens chain-ids)))
|
||||||
|
|
||||||
(rf/reg-sub
|
(rf/reg-sub
|
||||||
:wallet/aggregated-token-values-and-balance
|
:wallet/aggregated-token-values-and-balance
|
||||||
:<- [:wallet/aggregated-tokens-in-selected-networks]
|
:<- [:wallet/aggregated-tokens-in-selected-networks]
|
||||||
:<- [:profile/customization-color]
|
:<- [:profile/customization-color]
|
||||||
:<- [:profile/currency]
|
:<- [:profile/currency]
|
||||||
:<- [:profile/currency-symbol]
|
:<- [:profile/currency-symbol]
|
||||||
(fn [[aggregated-tokens color currency currency-symbol]]
|
(fn [[aggregated-tokens color currency currency-symbol]]
|
||||||
(let [balance (utils/calculate-balance-from-tokens {:currency currency
|
(let [balance (utils/calculate-balance-from-tokens {:currency currency
|
||||||
:tokens aggregated-tokens})
|
:tokens aggregated-tokens})
|
||||||
formatted-balance (utils/prettify-balance currency-symbol balance)]
|
formatted-balance (utils/prettify-balance currency-symbol balance)
|
||||||
{:balance balance
|
token-values (mapv #(utils/calculate-token-value {:token %
|
||||||
:formatted-balance formatted-balance
|
:color color
|
||||||
:tokens (mapv #(utils/calculate-token-value {:token %
|
:currency currency
|
||||||
:color color
|
:currency-symbol currency-symbol})
|
||||||
:currency currency
|
aggregated-tokens)
|
||||||
:currency-symbol currency-symbol})
|
sorted-token-values (sort-by #(-> % :values :fiat-unformatted-value) > token-values)]
|
||||||
aggregated-tokens)})))
|
{:balance balance
|
||||||
|
:formatted-balance formatted-balance
|
||||||
|
:tokens sorted-token-values})))
|
||||||
|
|
||||||
|
|
||||||
(rf/reg-sub
|
(rf/reg-sub
|
||||||
:wallet/network-preference-details
|
:wallet/network-preference-details
|
||||||
|
|
Loading…
Reference in New Issue