From 8a16017859a2dbe7baef8947af0183064c571eab Mon Sep 17 00:00:00 2001 From: Omar Basem Date: Mon, 15 Jan 2024 20:57:55 +0400 Subject: [PATCH] Wallet: send token from drawer (#18429) * feat: send token drawer --- src/quo/components/list_items/token_network/style.cljs | 4 ++-- src/status_im/contexts/wallet/common/utils.cljs | 1 + src/status_im/contexts/wallet/send/events.cljs | 1 + src/status_im/contexts/wallet/send/input_amount/view.cljs | 4 +--- src/status_im/contexts/wallet/send/select_address/view.cljs | 3 +++ 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/quo/components/list_items/token_network/style.cljs b/src/quo/components/list_items/token_network/style.cljs index efd651ec6f..0ce4ec51f6 100644 --- a/src/quo/components/list_items/token_network/style.cljs +++ b/src/quo/components/list_items/token_network/style.cljs @@ -27,7 +27,7 @@ (def info {:flex-direction :row :align-items :center - :width "60%"}) + :width "70%"}) (def token-info {:height 40 @@ -42,7 +42,7 @@ (def values-container {:align-items :flex-end - :max-width "40%"}) + :max-width "30%"}) (defn fiat-value [theme] diff --git a/src/status_im/contexts/wallet/common/utils.cljs b/src/status_im/contexts/wallet/common/utils.cljs index 901012b050..02e666c824 100644 --- a/src/status_im/contexts/wallet/common/utils.cljs +++ b/src/status_im/contexts/wallet/common/utils.cljs @@ -179,6 +179,7 @@ "<$0.01" (prettify-balance currency-symbol fiat-value))) + (defn calculate-token-value "This function returns token values in the props of token-value (quo) component" [{:keys [token color currency currency-symbol]}] diff --git a/src/status_im/contexts/wallet/send/events.cljs b/src/status_im/contexts/wallet/send/events.cljs index 1ccec12292..95a43061d2 100644 --- a/src/status_im/contexts/wallet/send/events.cljs +++ b/src/status_im/contexts/wallet/send/events.cljs @@ -40,6 +40,7 @@ (update-in [:wallet :ui :send] dissoc :route) (update-in [:wallet :ui :send] dissoc :loading-suggested-routes?))})) + (rf/reg-event-fx :wallet/select-send-account-address (fn [{:keys [db]} [{:keys [address stack-id]}]] {:db (-> db 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 4318a2738a..d0f2e438f9 100644 --- a/src/status_im/contexts/wallet/send/input_amount/view.cljs +++ b/src/status_im/contexts/wallet/send/input_amount/view.cljs @@ -155,9 +155,7 @@ :left-action :dot :delete-key? true :on-press handle-keyboard-press - :on-delete handle-delete}] - ] - )))) + :on-delete handle-delete}]])))) (defn- view-internal [props] diff --git a/src/status_im/contexts/wallet/send/select_address/view.cljs b/src/status_im/contexts/wallet/send/select_address/view.cljs index b6d334574b..70acce1eb3 100644 --- a/src/status_im/contexts/wallet/send/select_address/view.cljs +++ b/src/status_im/contexts/wallet/send/select_address/view.cljs @@ -118,6 +118,7 @@ (rf/dispatch [:wallet/clean-scanned-address]) (rf/dispatch [:wallet/clean-local-suggestions]) (rf/dispatch [:wallet/clean-account-selection]) + (rf/dispatch [:wallet/clean-selected-token]) (rf/dispatch [:wallet/select-address-tab nil]) (rf/dispatch [:navigate-back])) on-change-tab #(rf/dispatch [:wallet/select-address-tab %]) @@ -125,6 +126,7 @@ input-focused? (reagent/atom false)] (fn [] (let [selected-tab (or (rf/sub [:wallet/send-tab]) (:id (first tabs-data))) + token (rf/sub [:wallet/wallet-send-token]) valid-ens-or-address? (boolean (rf/sub [:wallet/valid-ens-or-address?]))] (rn/use-effect (fn [] (fn [] @@ -143,6 +145,7 @@ :disabled? (not valid-ens-or-address?) :on-press #(rf/dispatch [:wallet/select-send-address {:address @input-value + :token token :stack-id :wallet-select-address}])} (i18n/label :t/continue)])} [quo/text-combinations