fix(swap): update swap icon and don't show contract address for eth swaps (#21410)

Signed-off-by: Brian Sztamfater <brian@status.im>
This commit is contained in:
Brian Sztamfater 2024-10-16 12:51:29 -03:00 committed by GitHub
parent 76882690d7
commit d58553f67a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 24 additions and 15 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 999 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -48,7 +48,7 @@
:accessibility-label :receive}]
(when swap-action
[action-button
{:icon :i/swap
{:icon :i/transaction
:text (i18n/label :t/swap)
:on-press swap-action
:theme theme

View File

@ -60,7 +60,8 @@
(defn- view-internal
[{:keys [type account-props token-props networks? values]}]
(let [theme (quo.theme/use-theme)]
(let [theme (quo.theme/use-theme)
address (or (:address account-props) (:address token-props))]
[rn/view
{:style (style/container networks? theme)}
[rn/view
@ -89,12 +90,13 @@
(get-in account-props [:status-account :name])]
[rn/view
{:style (style/dot-divider theme)}]])
[text/text
{:size (when (not= type :account) :paragraph-2)
:weight (when (= type :account) :semi-bold)
:style {:color (when (not= type :account)
(colors/theme-colors colors/neutral-50 colors/neutral-40 theme))}}
(or (:address account-props) (:address token-props))]]]]
(when address
[text/text
{:size (when (not= type :account) :paragraph-2)
:weight (when (= type :account) :semi-bold)
:style {:color (when (not= type :account)
(colors/theme-colors colors/neutral-50 colors/neutral-40 theme))}}
address])]]]
(when networks?
[:<>
[rn/view

View File

@ -17,7 +17,7 @@
(def transaction-icon
{:send :i/send
:swap :i/swap
:swap :i/transaction
:bridge :i/bridge})
(defn transaction-header

View File

@ -23,7 +23,7 @@
(def transaction-icon
{:receive :i/receive
:send :i/send
:swap :i/swap
:swap :i/transaction
:bridge :i/bridge
:buy :i/buy
:destroy :i/destroy

View File

@ -25,7 +25,7 @@
:title "floating button page"
:description "press right icon to swap button type"
:text-align :left
:right-side [{:icon-name :i/swap
:right-side [{:icon-name :i/transaction
:on-press #(swap! slide? not)}]
:background :blur
:icon-name :i/close

View File

@ -48,7 +48,7 @@
(defn- action-swap
[{:keys [token asset-to-receive token-symbol testnet-mode?]}]
{:icon :i/swap
{:icon :i/transaction
:accessibility-label :swap
:label (i18n/label :t/swap)
:disabled? testnet-mode?

View File

@ -80,7 +80,8 @@
:values (send-utils/network-values-for-ui network-values)
:token-props {:token token-symbol
:label (str amount " " token-symbol)
:address (address-utils/get-shortened-compressed-key token-address)
:address (when token-address
(address-utils/get-shortened-compressed-key token-address))
:size 32}}]]))
(defn- pay-section
@ -98,7 +99,8 @@
:label (i18n/label :t/pay)
:token-symbol pay-token-symbol
:amount pay-amount
:token-address pay-token-address
:token-address (when-not (address-utils/zero-address? pay-token-address)
pay-token-address)
:network network-name
:theme theme}]))
@ -117,7 +119,8 @@
:label (i18n/label :t/receive)
:token-symbol receive-token-symbol
:amount receive-amount
:token-address receive-token-address
:token-address (when-not (address-utils/zero-address? receive-token-address)
receive-token-address)
:network network-name
:theme theme}]))

View File

@ -10,6 +10,7 @@
(def regx-eip-3770-address #"^(?:(?:eth:|arb1:|oeth:)(?=:|))*0x[0-9a-fA-F]{40}$")
(def regx-metamask-address #"^ethereum:(0x[0-9a-fA-F]{40})(?:@(0x1|0xa|0xa4b1))?$")
(def regx-address-contains #"(?i)0x[a-fA-F0-9]{40}")
(def zero-address "0x0000000000000000000000000000000000000000")
(defn normalized-hex
[hex]
@ -137,3 +138,6 @@
(metamask-address? address)
(metamask-address->eth-address address)))
(defn zero-address?
[address]
(= address zero-address))