more subscriptions

This commit is contained in:
Volodymyr Kozieiev 2024-10-26 16:25:08 +01:00
parent c5eda74b19
commit e5cd07a92b
No known key found for this signature in database
GPG Key ID: 82B04968DF4C0535
3 changed files with 33 additions and 18 deletions

View File

@ -27,12 +27,18 @@
[balance]
(cut-fiat-balance balance 2))
(defn prettify-balance
[currency-symbol balance]
(defn prepend-curency-symbol-to-fiat-balance
[fiat-balance currency-symbol]
(let [formatted-symbol (if (> (count currency-symbol) 1)
(str currency-symbol " ")
currency-symbol)]
(str formatted-symbol (cut-fiat-balance-to-two-decimals balance))))
(str formatted-symbol fiat-balance)))
(defn prettify-balance
[currency-symbol fiat-balance]
(-> fiat-balance
cut-fiat-balance-to-two-decimals
(prepend-curency-symbol-to-fiat-balance currency-symbol)))
(defn get-derivation-path
[number-of-accounts]
@ -104,11 +110,15 @@
:else (number/remove-trailing-zeroes
(.toFixed token-units standardized-decimals-count)))))
(defn add-token-symbol-to-crypto-balance
[crypto-balance token-symbol]
(str crypto-balance " " (string/upper-case token-symbol)))
(defn prettify-crypto-balance
[token-symbol crypto-balance conversion-rate]
(str (cut-crypto-decimals-to-fit-usd-cents crypto-balance conversion-rate)
" "
(string/upper-case token-symbol)))
(-> crypto-balance
(cut-crypto-decimals-to-fit-usd-cents conversion-rate)
(add-token-symbol-to-crypto-balance token-symbol)))
(defn get-standard-crypto-format
"For full details: https://github.com/status-im/status-mobile/issues/18225"

View File

@ -169,10 +169,10 @@
:as token} (rf/sub [:wallet/wallet-send-token])
send-from-locked-amounts (rf/sub [:wallet/wallet-send-from-locked-amounts])
token-by-symbol (rf/sub [:send-input-amount-screen/token-by-symbol])
conversion-rate (rf/sub [:send-input-amount-screen/conversion-rate])
token-input-converted-value (rf/sub [:send-input-amount-screen/token-input-converted-value])
token-input-converted-value-prettified
(rf/sub [:send-input-amount-screen/token-input-converted-value-prettified])
max-decimals (rf/sub [:send-input-amount-screen/max-decimals])
currency-symbol (rf/sub [:profile/currency-symbol])
loading-routes? (rf/sub [:wallet/wallet-send-loading-suggested-routes?])
route (rf/sub [:wallet/wallet-send-route])
valid-input? (rf/sub [:send-input-amount-screen/valid-input?])
@ -248,16 +248,7 @@
:on-token-press show-select-asset-sheet
:error? value-out-of-limits?
:currency-symbol (if crypto-currency? token-symbol fiat-currency)
:converted-value (if crypto-currency?
(utils/prettify-balance
currency-symbol
(money/crypto->fiat input-value
conversion-rate))
(utils/prettify-crypto-balance
(or (clj->js token-symbol) "")
(money/fiat->crypto input-value
conversion-rate)
conversion-rate))
:converted-value token-input-converted-value-prettified
:hint-component [quo/network-tags
{:networks (seq from-enabled-networks)
:title (i18n/label

View File

@ -164,6 +164,20 @@
(crypto->fiat input-value conversion-rate)
(fiat->crypto input-value conversion-rate))))
(rf/reg-sub :send-input-amount-screen/token-input-converted-value-prettified
:<- [:send-input-amount-screen/state]
:<- [:send-input-amount-screen/token-input-converted-value]
:<- [:profile/currency-symbol]
:<- [:wallet/wallet-send-token]
(fn [[{:keys [crypto-currency?]}
token-input-converted-value
currency-symbol
{token-symbol :symbol}]]
(if crypto-currency?
(utils/prepend-curency-symbol-to-fiat-balance token-input-converted-value currency-symbol)
(utils/add-token-symbol-to-crypto-balance token-input-converted-value
(or (clj->js token-symbol) "")))))
(rf/reg-sub :send-input-amount-screen/amount-in-crypto
:<- [:send-input-amount-screen/state]
:<- [:send-input-amount-screen/conversion-rate]