Wallet design review fixes (#21542)
* feat: hide token price-change info if no token balance * fix: show dapps header button only on account screen * ref: renamed to above-zero? and using it where needed * fix: removed bridge icon from submit button
This commit is contained in:
parent
87483b1ef4
commit
e59b782b86
|
@ -35,8 +35,9 @@
|
||||||
#(rf/dispatch [:wallet/fetch-activities-for-current-account]))
|
#(rf/dispatch [:wallet/fetch-activities-for-current-account]))
|
||||||
[rn/view {:style {:flex 1}}
|
[rn/view {:style {:flex 1}}
|
||||||
[account-switcher/view
|
[account-switcher/view
|
||||||
{:type :wallet-networks
|
{:type :wallet-networks
|
||||||
:on-press #(rf/dispatch [:pop-to-root :shell-stack])}]
|
:show-dapps-button? true
|
||||||
|
:on-press #(rf/dispatch [:pop-to-root :shell-stack])}]
|
||||||
[quo/account-overview
|
[quo/account-overview
|
||||||
{:container-style style/account-overview
|
{:container-style style/account-overview
|
||||||
:current-value formatted-balance
|
:current-value formatted-balance
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
[input-amount/view
|
[input-amount/view
|
||||||
{:current-screen-id :screen/wallet.bridge-input-amount
|
{:current-screen-id :screen/wallet.bridge-input-amount
|
||||||
:button-one-label (i18n/label :t/review-bridge)
|
:button-one-label (i18n/label :t/review-bridge)
|
||||||
:button-one-props {:icon-left :i/bridge}
|
|
||||||
:enabled-from-chain-ids (rf/sub
|
:enabled-from-chain-ids (rf/sub
|
||||||
[:wallet/bridge-from-chain-ids])
|
[:wallet/bridge-from-chain-ids])
|
||||||
:from-enabled-networks (rf/sub [:wallet/bridge-from-networks])
|
:from-enabled-networks (rf/sub [:wallet/bridge-from-networks])
|
||||||
|
|
|
@ -16,15 +16,17 @@
|
||||||
[select-account/view params])}
|
[select-account/view params])}
|
||||||
nil))
|
nil))
|
||||||
|
|
||||||
(defn- on-dapps-press
|
(defn- on-switcher-press
|
||||||
[switcher-type params]
|
[switcher-type params]
|
||||||
(rf/dispatch [:show-bottom-sheet (get-bottom-sheet-args switcher-type params)]))
|
(rf/dispatch [:show-bottom-sheet (get-bottom-sheet-args switcher-type params)]))
|
||||||
|
|
||||||
(defn view
|
(defn view
|
||||||
[{:keys [type on-press accessibility-label icon-name switcher-type margin-top params]
|
[{:keys [type on-press accessibility-label icon-name switcher-type margin-top params
|
||||||
|
show-dapps-button?]
|
||||||
:or {icon-name :i/close
|
:or {icon-name :i/close
|
||||||
accessibility-label :top-bar
|
accessibility-label :top-bar
|
||||||
switcher-type :account-options
|
switcher-type :account-options
|
||||||
|
show-dapps-button? false
|
||||||
type :no-title}}]
|
type :no-title}}]
|
||||||
(let [{:keys [color emoji watch-only?]} (rf/sub [:wallet/current-viewing-account])
|
(let [{:keys [color emoji watch-only?]} (rf/sub [:wallet/current-viewing-account])
|
||||||
networks (rf/sub [:wallet/selected-network-details])
|
networks (rf/sub [:wallet/selected-network-details])
|
||||||
|
@ -40,12 +42,13 @@
|
||||||
:align-center? true
|
:align-center? true
|
||||||
:networks-on-press #(rf/dispatch [:show-bottom-sheet {:content network-filter/view}])
|
:networks-on-press #(rf/dispatch [:show-bottom-sheet {:content network-filter/view}])
|
||||||
:right-side [(when (and (ff/enabled? ::ff/wallet.wallet-connect)
|
:right-side [(when (and (ff/enabled? ::ff/wallet.wallet-connect)
|
||||||
(not watch-only?))
|
(not watch-only?)
|
||||||
|
show-dapps-button?)
|
||||||
{:icon-name :i/dapps
|
{:icon-name :i/dapps
|
||||||
:on-press #(rf/dispatch [:navigate-to :screen/wallet.connected-dapps])})
|
:on-press #(rf/dispatch [:navigate-to :screen/wallet.connected-dapps])})
|
||||||
(when-not sending-collectible?
|
(when-not sending-collectible?
|
||||||
{:content-type :account-switcher
|
{:content-type :account-switcher
|
||||||
:customization-color color
|
:customization-color color
|
||||||
:on-press #(on-dapps-press switcher-type params)
|
:on-press #(on-switcher-press switcher-type params)
|
||||||
:emoji emoji
|
:emoji emoji
|
||||||
:type (when watch-only? :watch-only)})]}]))
|
:type (when watch-only? :watch-only)})]}]))
|
||||||
|
|
|
@ -93,7 +93,7 @@
|
||||||
(assoc :token token-data
|
(assoc :token token-data
|
||||||
:stack-id :screen/wallet.accounts
|
:stack-id :screen/wallet.accounts
|
||||||
:has-balance? (-> (get-in token [:values :fiat-unformatted-value])
|
:has-balance? (-> (get-in token [:values :fiat-unformatted-value])
|
||||||
(money/greater-than (money/bignumber "0"))))
|
money/above-zero?))
|
||||||
(not selected-account)
|
(not selected-account)
|
||||||
(assoc :token-symbol token-symbol
|
(assoc :token-symbol token-symbol
|
||||||
:stack-id :wallet-stack))]
|
:stack-id :wallet-stack))]
|
||||||
|
|
|
@ -187,8 +187,7 @@
|
||||||
(money/bignumber 0))
|
(money/bignumber 0))
|
||||||
amount-fixed-decimals (number/to-fixed number display-decimals)]
|
amount-fixed-decimals (number/to-fixed number display-decimals)]
|
||||||
(if (and (= amount-fixed-decimals "0")
|
(if (and (= amount-fixed-decimals "0")
|
||||||
(money/greater-than amount
|
(money/above-zero? amount))
|
||||||
(money/bignumber 0)))
|
|
||||||
(number/small-number-threshold display-decimals)
|
(number/small-number-threshold display-decimals)
|
||||||
(str amount-fixed-decimals))))
|
(str amount-fixed-decimals))))
|
||||||
|
|
||||||
|
@ -286,7 +285,7 @@
|
||||||
{:token (:symbol token)
|
{:token (:symbol token)
|
||||||
:token-name (:name token)
|
:token-name (:name token)
|
||||||
:state :default
|
:state :default
|
||||||
:metrics? true
|
:metrics? (money/above-zero? balance)
|
||||||
:status (cond
|
:status (cond
|
||||||
(pos? change-pct-24hour) :positive
|
(pos? change-pct-24hour) :positive
|
||||||
(neg? change-pct-24hour) :negative
|
(neg? change-pct-24hour) :negative
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
"Same as `network-list`, but only returns the networks that have a positive token balance"
|
"Same as `network-list`, but only returns the networks that have a positive token balance"
|
||||||
[{:keys [balances-per-chain] :as token} networks]
|
[{:keys [balances-per-chain] :as token} networks]
|
||||||
(as-> balances-per-chain $
|
(as-> balances-per-chain $
|
||||||
(filter #(-> % second :raw-balance (money/greater-than 0)) $)
|
(filter #(-> % second :raw-balance money/above-zero?) $)
|
||||||
(assoc token :balances-per-chain $)
|
(assoc token :balances-per-chain $)
|
||||||
(network-list $ networks)))
|
(network-list $ networks)))
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@
|
||||||
(or (not only-with-balance?)
|
(or (not only-with-balance?)
|
||||||
(and only-with-balance?
|
(and only-with-balance?
|
||||||
(money/bignumber? raw-balance)
|
(money/bignumber? raw-balance)
|
||||||
(money/greater-than raw-balance (money/bignumber "0")))))))
|
(money/above-zero? raw-balance))))))
|
||||||
(map first))))
|
(map first))))
|
||||||
|
|
||||||
(def ^:private network-priority-score
|
(def ^:private network-priority-score
|
||||||
|
@ -220,7 +220,7 @@
|
||||||
(fn [network-amount]
|
(fn [network-amount]
|
||||||
(or (and receiver?
|
(or (and receiver?
|
||||||
(or (contains? receiver-networks-set (:chain-id network-amount))
|
(or (contains? receiver-networks-set (:chain-id network-amount))
|
||||||
(money/greater-than (:total-amount network-amount) (money/bignumber "0"))))
|
(money/above-zero? (:total-amount network-amount))))
|
||||||
(not receiver?))))
|
(not receiver?))))
|
||||||
(vec))
|
(vec))
|
||||||
(and receiver?
|
(and receiver?
|
||||||
|
|
|
@ -51,8 +51,7 @@
|
||||||
amount-out-minus-slippage (money/sub (money/bignumber amount-out-num) slippage-num)
|
amount-out-minus-slippage (money/sub (money/bignumber amount-out-num) slippage-num)
|
||||||
display-decimals (min receive-token-decimals
|
display-decimals (min receive-token-decimals
|
||||||
constants/min-token-decimals-to-display)
|
constants/min-token-decimals-to-display)
|
||||||
receive-amount (if (money/greater-than amount-out-minus-slippage
|
receive-amount (if (money/above-zero? amount-out-minus-slippage)
|
||||||
(money/bignumber 0))
|
|
||||||
(str (utils/sanitized-token-amount-to-display
|
(str (utils/sanitized-token-amount-to-display
|
||||||
amount-out-minus-slippage
|
amount-out-minus-slippage
|
||||||
display-decimals))
|
display-decimals))
|
||||||
|
|
|
@ -245,6 +245,13 @@
|
||||||
(.times fiat-price-bn)
|
(.times fiat-price-bn)
|
||||||
(with-precision 2)))))
|
(with-precision 2)))))
|
||||||
|
|
||||||
|
(defn above-zero?
|
||||||
|
[^js balance]
|
||||||
|
(when balance
|
||||||
|
(->> 0
|
||||||
|
bignumber
|
||||||
|
(greater-than balance))))
|
||||||
|
|
||||||
(defn sufficient-funds?
|
(defn sufficient-funds?
|
||||||
[^js amount ^js balance]
|
[^js amount ^js balance]
|
||||||
(when (and amount balance)
|
(when (and amount balance)
|
||||||
|
|
Loading…
Reference in New Issue