chore(wallet): some minor cleanups: move sheets to appropriate level, remove unused rf event, improve one rf event api (#18895)

This commit is contained in:
Jamie Caprani 2024-03-04 20:34:21 +00:00 committed by GitHub
parent 0be66e28c1
commit 191c876f47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 35 additions and 40 deletions

View File

@ -7,8 +7,8 @@
[reagent.core :as reagent]
[status-im.contexts.shell.share.style :as style]
[status-im.contexts.shell.share.wallet.style :as wallet-style]
[status-im.contexts.wallet.common.sheets.network-preferences.view :as network-preferences]
[status-im.contexts.wallet.common.utils :as utils]
[status-im.contexts.wallet.sheets.network-preferences.view :as network-preferences]
[utils.i18n :as i18n]
[utils.image-server :as image-server]
[utils.re-frame :as rf]))

View File

@ -1,8 +1,8 @@
(ns status-im.contexts.wallet.common.account-switcher.view
(:require [quo.core :as quo]
[status-im.contexts.wallet.common.sheets.account-options.view :as account-options]
[status-im.contexts.wallet.common.sheets.network-filter.view :as network-filter]
[status-im.contexts.wallet.common.sheets.select-account.view :as select-account]
[status-im.contexts.wallet.sheets.account-options.view :as account-options]
[status-im.contexts.wallet.sheets.network-filter.view :as network-filter]
[status-im.contexts.wallet.sheets.select-account.view :as select-account]
[status-im.feature-flags :as ff]
[utils.re-frame :as rf]))

View File

@ -1,4 +0,0 @@
(ns status-im.contexts.wallet.common.sheets.select-account.style)
(def list-container
{:margin-horizontal 8})

View File

@ -10,10 +10,10 @@
[status-im.common.emoji-picker.utils :as emoji-picker.utils]
[status-im.common.standard-authentication.core :as standard-auth]
[status-im.constants :as constants]
[status-im.contexts.wallet.common.sheets.account-origin.view :as account-origin]
[status-im.contexts.wallet.common.utils :as utils]
[status-im.contexts.wallet.create-account.style :as style]
[status-im.contexts.wallet.create-account.utils :as create-account.utils]
[status-im.contexts.wallet.sheets.account-origin.view :as account-origin]
[utils.i18n :as i18n]
[utils.re-frame :as rf]
[utils.responsiveness :refer [iphone-11-Pro-20-pixel-from-width]]

View File

@ -5,10 +5,10 @@
[reagent.core :as reagent]
[status-im.contexts.wallet.common.screen-base.create-or-edit-account.view
:as create-or-edit-account]
[status-im.contexts.wallet.common.sheets.network-preferences.view
:as network-preferences]
[status-im.contexts.wallet.common.sheets.remove-account.view :as remove-account]
[status-im.contexts.wallet.edit-account.style :as style]
[status-im.contexts.wallet.sheets.network-preferences.view
:as network-preferences]
[status-im.contexts.wallet.sheets.remove-account.view :as remove-account]
[status-im.feature-flags :as ff]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

View File

@ -4,9 +4,9 @@
[react-native.core :as rn]
[reagent.core :as reagent]
[status-im.common.home.top-nav.view :as common.top-nav]
[status-im.contexts.wallet.common.sheets.network-filter.view :as network-filter]
[status-im.contexts.wallet.home.style :as style]
[status-im.contexts.wallet.home.tabs.view :as tabs]
[status-im.contexts.wallet.sheets.network-filter.view :as network-filter]
[status-im.feature-flags :as ff]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

View File

@ -45,20 +45,13 @@
(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
(assoc-in [:wallet :ui :send :send-account-address] address)
(update-in [:wallet :ui :send] dissoc :to-address))
:fx [[:dispatch [:navigate-to-within-stack [:wallet-select-asset stack-id]]]]}))
(rf/reg-event-fx :wallet/clean-send-address
(fn [{:keys [db]}]
{:db (update-in db [:wallet :ui :send] dissoc :recipient :to-address)}))
(rf/reg-event-fx
:wallet/select-send-address
(fn [{:keys [db]} [{:keys [address token recipient stack-id]}]]
(fn [{:keys [db]} [{:keys [address token? recipient stack-id]}]]
(let [[prefix to-address] (utils/split-prefix-and-address address)
test-net? (get-in db [:profile/profile :test-networks-enabled?])
goerli-enabled? (get-in db [:profile/profile :is-goerli-enabled?])
@ -73,7 +66,7 @@
(assoc-in [:wallet :ui :send :selected-networks] selected-networks))
:fx [[:dispatch
[:navigate-to-within-stack
(if token
(if token?
[:wallet-send-input-amount stack-id]
[:wallet-select-asset stack-id])]]]})))

View File

@ -14,6 +14,7 @@
{:account-props (assoc account :customization-color color)
:on-press #(rf/dispatch [:wallet/select-send-address
{:address address
:token? false
:recipient account
:stack-id :wallet-select-address}])}])

View File

@ -93,6 +93,7 @@
(when-not ens
(rf/dispatch [:wallet/select-send-address
{:address address
:token? false
:recipient local-suggestion
:stack-id :wallet-select-address}]))))
:active-state? false}]
@ -156,7 +157,7 @@
:disabled? (not valid-ens-or-address?)
:on-press #(rf/dispatch [:wallet/select-send-address
{:address @input-value
:token token
:token? (some? token)
:stack-id
:wallet-select-address}])
:customization-color color}

View File

@ -6,9 +6,9 @@
[react-native.safe-area :as safe-area]
[react-native.share :as share]
[reagent.core :as reagent]
[status-im.contexts.wallet.common.sheets.network-preferences.view :as network-preferences]
[status-im.contexts.wallet.common.utils :as utils]
[status-im.contexts.wallet.share-address.style :as style]
[status-im.contexts.wallet.sheets.network-preferences.view :as network-preferences]
[utils.i18n :as i18n]
[utils.image-server :as image-server]
[utils.re-frame :as rf]))

View File

@ -1,4 +1,4 @@
(ns status-im.contexts.wallet.common.sheets.account-options.style)
(ns status-im.contexts.wallet.sheets.account-options.style)
(def drawer-section-label
{:padding-horizontal 20

View File

@ -1,4 +1,4 @@
(ns status-im.contexts.wallet.common.sheets.account-options.view
(ns status-im.contexts.wallet.sheets.account-options.view
(:require [oops.core :as oops]
[quo.core :as quo]
[quo.foundations.colors :as colors]
@ -9,9 +9,9 @@
[react-native.gesture :as gesture]
[react-native.platform :as platform]
[reagent.core :as reagent]
[status-im.contexts.wallet.common.sheets.account-options.style :as style]
[status-im.contexts.wallet.common.sheets.remove-account.view :as remove-account]
[status-im.contexts.wallet.common.utils :as utils]
[status-im.contexts.wallet.sheets.account-options.style :as style]
[status-im.contexts.wallet.sheets.remove-account.view :as remove-account]
[status-im.feature-flags :as ff]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

View File

@ -1,4 +1,4 @@
(ns status-im.contexts.wallet.common.sheets.account-origin.style
(ns status-im.contexts.wallet.sheets.account-origin.style
(:require [react-native.platform :as platform]))
(def header-container

View File

@ -1,10 +1,10 @@
(ns status-im.contexts.wallet.common.sheets.account-origin.view
(ns status-im.contexts.wallet.sheets.account-origin.view
(:require
[quo.core :as quo]
[quo.theme]
[react-native.core :as rn]
[status-im.constants :as const]
[status-im.contexts.wallet.common.sheets.account-origin.style :as style]
[status-im.contexts.wallet.sheets.account-origin.style :as style]
[utils.i18n :as i18n]))
(defn- header

View File

@ -1,4 +1,4 @@
(ns status-im.contexts.wallet.common.sheets.network-filter.view
(ns status-im.contexts.wallet.sheets.network-filter.view
(:require
[quo.core :as quo]
[reagent.core :as reagent]

View File

@ -1,4 +1,4 @@
(ns status-im.contexts.wallet.common.sheets.network-preferences.style
(ns status-im.contexts.wallet.sheets.network-preferences.style
(:require [quo.foundations.colors :as colors]))
(def blur

View File

@ -1,11 +1,11 @@
(ns status-im.contexts.wallet.common.sheets.network-preferences.view
(ns status-im.contexts.wallet.sheets.network-preferences.view
(:require [quo.core :as quo]
[quo.foundations.colors :as colors]
[quo.theme :as quo.theme]
[react-native.blur :as blur]
[reagent.core :as reagent]
[status-im.contexts.wallet.common.sheets.network-preferences.style :as style]
[status-im.contexts.wallet.common.utils :as utils]
[status-im.contexts.wallet.sheets.network-preferences.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

View File

@ -1,4 +1,4 @@
(ns status-im.contexts.wallet.common.sheets.remove-account.style)
(ns status-im.contexts.wallet.sheets.remove-account.style)
(def desc-container
{:padding-horizontal 20

View File

@ -1,12 +1,12 @@
(ns status-im.contexts.wallet.common.sheets.remove-account.view
(ns status-im.contexts.wallet.sheets.remove-account.view
(:require
[quo.core :as quo]
[quo.theme]
[react-native.clipboard :as clipboard]
[react-native.core :as rn]
[reagent.core :as reagent]
[status-im.contexts.wallet.common.sheets.remove-account.style :as style]
[status-im.contexts.wallet.common.utils :as utils]
[status-im.contexts.wallet.sheets.remove-account.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

View File

@ -0,0 +1,4 @@
(ns status-im.contexts.wallet.sheets.select-account.style)
(def list-container
{:margin-horizontal 8})

View File

@ -1,8 +1,8 @@
(ns status-im.contexts.wallet.common.sheets.select-account.view
(ns status-im.contexts.wallet.sheets.select-account.view
(:require [quo.core :as quo]
quo.theme
[react-native.gesture :as gesture]
[status-im.contexts.wallet.common.sheets.select-account.style :as style]
[status-im.contexts.wallet.sheets.select-account.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))