From 9728eb3055fb8e7f0cfe2bdd283c381ad9dbd9cd Mon Sep 17 00:00:00 2001 From: tumanov-alex Date: Tue, 31 Oct 2023 19:00:34 +0100 Subject: [PATCH] Use conventional approach to extract account name --- .../drawers/bottom_actions/style.cljs | 7 +++--- .../wallet/address_add_edit/views.cljs | 22 ++++++++++--------- .../contexts/wallet/address_watch/view.cljs | 4 +--- src/status_im2/contexts/wallet/home/view.cljs | 6 +---- 4 files changed, 18 insertions(+), 21 deletions(-) diff --git a/src/quo/components/drawers/bottom_actions/style.cljs b/src/quo/components/drawers/bottom_actions/style.cljs index e47ee6d39b04..b47b03382551 100644 --- a/src/quo/components/drawers/bottom_actions/style.cljs +++ b/src/quo/components/drawers/bottom_actions/style.cljs @@ -3,9 +3,10 @@ [quo.foundations.colors :as colors])) (def buttons-container - {:flex-direction :row - :justify-content :space-around - :padding-vertical 12}) + {:flex-direction :row + :justify-content :space-around + :padding-vertical 12 + :padding-horizontal 20}) (def button-container {:flex 1}) diff --git a/src/status_im/ui/screens/wallet/address_add_edit/views.cljs b/src/status_im/ui/screens/wallet/address_add_edit/views.cljs index 5ffa4edee7e2..cae0cf745aba 100644 --- a/src/status_im/ui/screens/wallet/address_add_edit/views.cljs +++ b/src/status_im/ui/screens/wallet/address_add_edit/views.cljs @@ -15,16 +15,18 @@ (defn- view-internal [] - (let [{:keys [accounts-count address]} (rf/sub [:get-screen-params]) - {:keys [customization-color]} (rf/sub [:profile/multiaccount]) - account-name (reagent/atom (str "Account " accounts-count)) - address-title (i18n/label :t/watch-address) - account-color (reagent/atom customization-color) - account-emoji (reagent/atom (emoji-picker.utils/random-emoji)) - on-change-name #(reset! account-name %) - on-change-color #(reset! account-color %) - on-change-emoji #(reset! account-emoji %) - safe-bottom (safe-area/get-bottom)] + (let [{:keys [address]} (rf/sub [:get-screen-params]) + {:keys [customization-color]} (rf/sub [:profile/multiaccount]) + number-of-accounts (count (rf/sub [:profile/wallet-accounts])) + account-name (reagent/atom (i18n/label :t/default-account-name + {:number (inc number-of-accounts)})) + address-title (i18n/label :t/watch-address) + account-color (reagent/atom customization-color) + account-emoji (reagent/atom (emoji-picker.utils/random-emoji)) + on-change-name #(reset! account-name %) + on-change-color #(reset! account-color %) + on-change-emoji #(reset! account-emoji %) + safe-bottom (safe-area/get-bottom)] (fn [] [rn/view {:style style/container} [create-or-edit-account/view diff --git a/src/status_im2/contexts/wallet/address_watch/view.cljs b/src/status_im2/contexts/wallet/address_watch/view.cljs index e48f4562918b..f20afeec38b3 100644 --- a/src/status_im2/contexts/wallet/address_watch/view.cljs +++ b/src/status_im2/contexts/wallet/address_watch/view.cljs @@ -17,7 +17,6 @@ (let [top (safe-area/get-top) bottom (safe-area/get-bottom) input-value (reagent/atom "") - {:keys [accounts-count]} (rf/sub [:get-screen-params]) {:keys [customization-color]} (rf/sub [:profile/multiaccount])] (fn [] [rn/view @@ -50,8 +49,7 @@ :disabled? (clojure.string/blank? @input-value) :on-press #(re-frame/dispatch [:navigate-to :address-to-watch-edit - {:accounts-count accounts-count - :address @input-value}]) + {:address @input-value}]) :container-style (style/button-container bottom)} (i18n/label :t/continue)]]))) (def view (quo.theme/with-theme view-internal)) diff --git a/src/status_im2/contexts/wallet/home/view.cljs b/src/status_im2/contexts/wallet/home/view.cljs index 00839887bc61..f9e4bbcb1d0e 100644 --- a/src/status_im2/contexts/wallet/home/view.cljs +++ b/src/status_im2/contexts/wallet/home/view.cljs @@ -13,8 +13,6 @@ [utils.i18n :as i18n] [utils.re-frame :as rf])) -(declare account-cards) - (defn new-account [] [quo/action-drawer @@ -27,9 +25,7 @@ :accessibility-label :add-a-contact :label (i18n/label :t/add-address) :sub-label (i18n/label :t/add-address-description) - :on-press #(rf/dispatch [:navigate-to :wallet-address-watch - {:accounts-count (count - account-cards)}]) + :on-press #(rf/dispatch [:navigate-to :wallet-address-watch]) :add-divider? true}]]]) (def account-cards