Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cadd2d73c3 | ||
|
|
dca4383444 |
@@ -8,7 +8,7 @@
|
||||
[token]
|
||||
(let [token-symbol (cond-> token
|
||||
(keyword? token) name
|
||||
:always (comp string/lower-case str))]
|
||||
:always string/lower-case)]
|
||||
(get tokens token-symbol)))
|
||||
|
||||
(def get-token-image (memoize get-token-image*))
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
[react-native.safe-area :as safe-area]
|
||||
[reagent.core :as reagent]
|
||||
[status-im.contexts.wallet.common.account-switcher.view :as account-switcher]
|
||||
[status-im.contexts.wallet.common.utils :as utils]
|
||||
[status-im.contexts.wallet.send.input-amount.style :as style]
|
||||
[status-im.contexts.wallet.send.routes.view :as routes]
|
||||
[utils.debounce :as debounce]
|
||||
@@ -54,7 +53,6 @@
|
||||
[{:keys [rate limit]}]
|
||||
(let [bottom (safe-area/get-bottom)
|
||||
{:keys [currency]} (rf/sub [:profile/profile])
|
||||
networks (rf/sub [:wallet/network-details])
|
||||
token (rf/sub [:wallet/wallet-send-token])
|
||||
loading-suggested-routes? (rf/sub [:wallet/wallet-send-loading-suggested-routes?])
|
||||
token-symbol (:symbol token)
|
||||
@@ -97,18 +95,16 @@
|
||||
:or {on-confirm #(rf/dispatch [:wallet/send-select-amount
|
||||
{:amount @input-value
|
||||
:stack-id :wallet-send-input-amount}])}}]
|
||||
(let [limit-label (make-limit-label @current-limit)
|
||||
input-num-value (parse-double @input-value)
|
||||
route (rf/sub [:wallet/wallet-send-route])
|
||||
loading-suggested-routes? (rf/sub [:wallet/wallet-send-loading-suggested-routes?])
|
||||
confirm-disabled? (or
|
||||
(nil? route)
|
||||
(empty? @input-value)
|
||||
(<= input-num-value 0)
|
||||
(> input-num-value (:amount @current-limit)))
|
||||
from-network (utils/id->network (get-in route [:From :chainId]))
|
||||
to-network (utils/id->network (get-in route [:To :chainId]))
|
||||
amount (str @input-value " " token-symbol)]
|
||||
(let [limit-label (make-limit-label @current-limit)
|
||||
input-num-value (parse-double @input-value)
|
||||
token (rf/sub [:wallet/wallet-send-token])
|
||||
route (rf/sub [:wallet/wallet-send-route])
|
||||
confirm-disabled? (or
|
||||
(nil? route)
|
||||
(empty? @input-value)
|
||||
(<= input-num-value 0)
|
||||
(> input-num-value (:amount @current-limit)))
|
||||
amount (str @input-value " " token-symbol)]
|
||||
(rn/use-effect
|
||||
(fn []
|
||||
(let [dismiss-keyboard-fn #(when (= % "active") (rn/dismiss-keyboard!))
|
||||
@@ -133,7 +129,7 @@
|
||||
{:container-style style/input-container
|
||||
:token token-symbol
|
||||
:currency currency
|
||||
:networks networks
|
||||
:networks (:networks token)
|
||||
:title (i18n/label :t/send-limit {:limit limit-label})
|
||||
:conversion conversion-rate
|
||||
:show-keyboard? false
|
||||
@@ -141,20 +137,11 @@
|
||||
:on-swap handle-swap
|
||||
:on-change-text (fn [text]
|
||||
(handle-on-change text))}]
|
||||
;; Network routing content to be added
|
||||
[rn/scroll-view
|
||||
{:content-container-style {:flex-grow 1
|
||||
:align-items :center
|
||||
:justify-content :center}}
|
||||
(cond loading-suggested-routes?
|
||||
[quo/text "Loading routes"]
|
||||
(and (not loading-suggested-routes?) route)
|
||||
[routes/view
|
||||
{:amount amount
|
||||
:from-network from-network
|
||||
:to-network to-network}]
|
||||
(and (not loading-suggested-routes?) (nil? route))
|
||||
[quo/text "Route not found"])]
|
||||
[routes/view
|
||||
{:amount amount
|
||||
:route route
|
||||
:input-value @input-value
|
||||
:networks (:networks token)}]
|
||||
[quo/bottom-actions
|
||||
{:actions :1-action
|
||||
:button-one-label (i18n/label :t/confirm)
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
(:require
|
||||
[quo.core :as quo]
|
||||
[react-native.core :as rn]
|
||||
[status-im.contexts.wallet.common.utils :as utils]
|
||||
[status-im.contexts.wallet.send.routes.style :as style]
|
||||
[utils.i18n :as i18n]))
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn view
|
||||
[{:keys [amount from-network to-network]}]
|
||||
(defn routes
|
||||
[{:keys [amount from-network to-network status]}]
|
||||
[rn/view {:style style/routes-container}
|
||||
[rn/view {:style style/routes-header-container}
|
||||
[quo/section-label
|
||||
@@ -19,7 +21,7 @@
|
||||
[quo/network-bridge
|
||||
{:amount amount
|
||||
:network from-network
|
||||
:status :default}]
|
||||
:status status}]
|
||||
[quo/network-link
|
||||
{:shape :linear
|
||||
:source from-network
|
||||
@@ -28,5 +30,26 @@
|
||||
[quo/network-bridge
|
||||
{:amount amount
|
||||
:network to-network
|
||||
:status :default
|
||||
:status status
|
||||
:container-style {:right 12}}]]])
|
||||
|
||||
(defn view
|
||||
[{:keys [amount route networks input-value]}]
|
||||
(let [loading-suggested-routes? (rf/sub [:wallet/wallet-send-loading-suggested-routes?])
|
||||
from-network (utils/id->network (get-in route [:From :chainId]))
|
||||
to-network (utils/id->network (get-in route [:To :chainId]))]
|
||||
[rn/scroll-view
|
||||
{:content-container-style {:flex-grow 1
|
||||
:align-items :center
|
||||
:justify-content :center}}
|
||||
(when (not (empty? input-value))
|
||||
(if (and (not loading-suggested-routes?) route)
|
||||
[routes
|
||||
{:amount amount
|
||||
:status :default
|
||||
:from-network from-network
|
||||
:to-network to-network}]
|
||||
[routes
|
||||
{:status :loading
|
||||
:from-network (:network-name (nth (seq networks) 1))
|
||||
:to-network (:network-name (nth (seq networks) 1))}]))]))
|
||||
|
||||
@@ -17,5 +17,5 @@
|
||||
|
||||
(def button
|
||||
{:justify-self :flex-end
|
||||
:margin-bottom 46
|
||||
:margin-bottom 20
|
||||
:margin-horizontal 20})
|
||||
|
||||
@@ -325,7 +325,8 @@
|
||||
|
||||
{:name :wallet-send-input-amount
|
||||
:options {:modalPresentationStyle :overCurrentContext
|
||||
:insets {:top? true}}
|
||||
:insets {:top? true
|
||||
:bottom? true}}
|
||||
:component wallet-send-input-amount/view}
|
||||
|
||||
{:name :wallet-select-address
|
||||
|
||||
Reference in New Issue
Block a user