diff --git a/src/quo/components/list_items/network_list/style.cljs b/src/quo/components/list_items/network_list/style.cljs index 39ace1723c9e..4fe65292855f 100644 --- a/src/quo/components/list_items/network_list/style.cljs +++ b/src/quo/components/list_items/network_list/style.cljs @@ -17,6 +17,7 @@ :padding-vertical 8 :border-radius 12 :height 56 + :opacity (if (= state :disabled) 0.3 1) :background-color (background-color state customization-color theme)}) (def info diff --git a/src/quo/components/list_items/network_list/view.cljs b/src/quo/components/list_items/network_list/view.cljs index ec2a57baeaee..c0fc534d8577 100644 --- a/src/quo/components/list_items/network_list/view.cljs +++ b/src/quo/components/list_items/network_list/view.cljs @@ -46,7 +46,7 @@ [:fiat-value :string] [:token-value :string] [:customization-color {:optional true} [:maybe :schema.common/customization-color]] - [:state {:optional true} [:enum :pressed :active :default]] + [:state {:optional true} [:enum :pressed :active :disabled :default]] [:on-press {:optional true} [:maybe fn?]]]]] :any]) @@ -61,9 +61,9 @@ internal-state (if pressed? :pressed state)] [rn/pressable {:style (style/container internal-state customization-color theme) - :on-press-in on-press-in - :on-press-out on-press-out - :on-press on-press + :on-press-in (when-not (= state :disabled) on-press-in) + :on-press-out (when-not (= state :disabled) on-press-out) + :on-press (when-not (= state :disabled) on-press) :accessibility-label :network-list} [info props] [values props]])) diff --git a/src/status_im/contexts/wallet/bridge/bridge_to/view.cljs b/src/status_im/contexts/wallet/bridge/bridge_to/view.cljs index 0cf26d28b194..cf8e06523198 100644 --- a/src/status_im/contexts/wallet/bridge/bridge_to/view.cljs +++ b/src/status_im/contexts/wallet/bridge/bridge_to/view.cljs @@ -8,27 +8,38 @@ [status-im.contexts.wallet.bridge.bridge-to.style :as style] [status-im.contexts.wallet.common.account-switcher.view :as account-switcher] [status-im.contexts.wallet.common.utils :as utils] + [status-im.contexts.wallet.common.utils.networks :as network-utils] [utils.i18n :as i18n] [utils.re-frame :as rf])) (defn- bridge-token-component [] (fn [{:keys [chain-id network-name]} token] - (let [network (rf/sub [:wallet/network-details-by-chain-id chain-id]) - currency (rf/sub [:profile/currency]) - currency-symbol (rf/sub [:profile/currency-symbol]) - balance (utils/calculate-total-token-balance token [chain-id]) - crypto-value (utils/get-standard-crypto-format token balance) - fiat-value (utils/calculate-token-fiat-value - {:currency currency - :balance balance - :token token}) - fiat-formatted (utils/get-standard-fiat-format crypto-value currency-symbol fiat-value)] + (let [theme (quo.theme/use-theme) + network (rf/sub [:wallet/network-details-by-chain-id chain-id]) + currency (rf/sub [:profile/currency]) + currency-symbol (rf/sub [:profile/currency-symbol]) + networks (rf/sub [:wallet/network-details]) + balance (utils/calculate-total-token-balance token [chain-id]) + crypto-value (utils/get-standard-crypto-format token balance) + fiat-value (utils/calculate-token-fiat-value + {:currency currency + :balance balance + :token token}) + fiat-formatted (utils/get-standard-fiat-format crypto-value + currency-symbol + fiat-value) + token-networks (network-utils/network-list token networks) + token-networks-ids (mapv #(:chain-id %) token-networks) + token-networks-ids-set (set token-networks-ids) + token-available-on-network? (contains? token-networks-ids-set chain-id)] [quo/network-list - {:label (name network-name) + {:theme theme + :label (name network-name) :network-image (quo.resources/get-network (:network-name network)) :token-value (str crypto-value " " (:symbol token)) :fiat-value fiat-formatted + :state (if token-available-on-network? :default :disabled) :on-press #(rf/dispatch [:wallet/select-bridge-network {:network-chain-id chain-id :stack-id :screen/wallet.bridge-to}])}]))) @@ -45,7 +56,7 @@ layer-2-networks (rest network-details) account-token (some #(when (= token-symbol (:symbol %)) %) tokens) bridge-to-title (i18n/label :t/bridge-to - {:name (string/upper-case (str (:name token)))})] + {:name (string/upper-case (str token-symbol))})] [rn/view [account-switcher/view {:on-press #(rf/dispatch [:navigate-back]) diff --git a/src/status_im/contexts/wallet/send/input_amount/view.cljs b/src/status_im/contexts/wallet/send/input_amount/view.cljs index c5c9ecbdab20..fed35235e745 100644 --- a/src/status_im/contexts/wallet/send/input_amount/view.cljs +++ b/src/status_im/contexts/wallet/send/input_amount/view.cljs @@ -212,9 +212,11 @@ [:wallet/wallet-send-sender-network-values]) receiver-network-values (rf/sub [:wallet/wallet-send-receiver-network-values]) - token-not-supported-in-receiver-networks? (every? #(= (:type %) :not-available) - (filter #(not= (:type %) :add) - receiver-network-values)) + tx-type (rf/sub [:wallet/wallet-send-tx-type]) + token-not-supported-in-receiver-networks? (and (not= tx-type :tx/bridge) + (every? #(= (:type %) :not-available) + (filter #(not= (:type %) :add) + receiver-network-values))) suggested-routes (rf/sub [:wallet/wallet-send-suggested-routes]) routes (when suggested-routes (or (:best suggested-routes) [])) diff --git a/src/status_im/subs/wallet/wallet.cljs b/src/status_im/subs/wallet/wallet.cljs index 9e31f43e6cb0..95c4c0924ae4 100644 --- a/src/status_im/subs/wallet/wallet.cljs +++ b/src/status_im/subs/wallet/wallet.cljs @@ -143,6 +143,11 @@ :<- [:wallet/wallet-send] :-> :network-links) +(rf/reg-sub + :wallet/wallet-send-tx-type + :<- [:wallet/wallet-send] + :-> :tx-type) + (rf/reg-sub :wallet/keypairs :<- [:wallet]