|
6 | 6 | [react-native.core :as rn] |
7 | 7 | [status-im.common.home.top-nav.view :as common.top-nav] |
8 | 8 | [status-im.common.refreshable-flat-list.view :as refreshable-flat-list] |
| 9 | + [status-im.constants :as constants] |
9 | 10 | [status-im.contexts.wallet.home.style :as style] |
10 | 11 | [status-im.contexts.wallet.home.tabs.view :as tabs] |
11 | 12 | [status-im.contexts.wallet.sheets.buy-token.view :as buy-token] |
|
16 | 17 |
|
17 | 18 | (defn new-account |
18 | 19 | [] |
19 | | - [quo/action-drawer |
20 | | - [[{:icon :i/add |
21 | | - :accessibility-label :start-a-new-chat |
22 | | - :label (i18n/label :t/add-account) |
23 | | - :sub-label (i18n/label :t/add-account-description) |
24 | | - :on-press #(rf/dispatch [:navigate-to :screen/wallet.create-account])} |
25 | | - (when (ff/enabled? ::ff/wallet.add-watched-address) |
| 20 | + (let [watched-accounts (rf/sub [:wallet/watch-only-accounts]) |
| 21 | + reached-max-watched-account? (>= (count watched-accounts) |
| 22 | + constants/max-allowed-watched-accounts) |
| 23 | + on-add-address-press (rn/use-callback |
| 24 | + (fn [] |
| 25 | + (if reached-max-watched-account? |
| 26 | + (rf/dispatch [:toasts/upsert |
| 27 | + {:type :negative |
| 28 | + :theme :dark |
| 29 | + :text |
| 30 | + (i18n/label |
| 31 | + :t/saved-addresses-limit-reached-toast)}]) |
| 32 | + (rf/dispatch [:navigate-to |
| 33 | + :screen/wallet.add-address-to-watch]))) |
| 34 | + [reached-max-watched-account?])] |
| 35 | + [quo/action-drawer |
| 36 | + [[{:icon :i/add |
| 37 | + :accessibility-label :start-a-new-chat |
| 38 | + :label (i18n/label :t/add-account) |
| 39 | + :sub-label (i18n/label :t/add-account-description) |
| 40 | + :on-press #(rf/dispatch [:navigate-to :screen/wallet.create-account])} |
26 | 41 | {:icon :i/reveal |
27 | 42 | :accessibility-label :add-a-contact |
28 | 43 | :label (i18n/label :t/add-address-to-watch) |
29 | 44 | :sub-label (i18n/label :t/add-address-to-watch-description) |
30 | | - :on-press #(rf/dispatch [:navigate-to :screen/wallet.add-address-to-watch]) |
31 | | - :add-divider? true})]]]) |
| 45 | + :on-press on-add-address-press |
| 46 | + :add-divider? true}]]])) |
32 | 47 |
|
33 | 48 | (defn- new-account-card-data |
34 | 49 | [] |
|
0 commit comments