|
1 | 1 | (ns status-im.contexts.wallet.common.sheets.network-preferences.view
|
2 |
| - (:require [clojure.string :as string] |
3 |
| - [quo.core :as quo] |
| 2 | + (:require [quo.core :as quo] |
4 | 3 | [quo.foundations.colors :as colors]
|
5 |
| - [quo.foundations.resources :as resources] |
6 | 4 | [quo.theme :as quo.theme]
|
7 | 5 | [react-native.blur :as blur]
|
8 | 6 | [reagent.core :as reagent]
|
9 | 7 | [status-im.contexts.wallet.common.sheets.network-preferences.style :as style]
|
| 8 | + [status-im.contexts.wallet.common.utils :as utils] |
10 | 9 | [utils.i18n :as i18n]
|
11 | 10 | [utils.re-frame :as rf]))
|
12 | 11 |
|
13 |
| - |
14 |
| -(defn- make-network-item |
15 |
| - [{:keys [network-name] :as _network} |
16 |
| - {:keys [title color on-change network-preferences state blur?] :as _options}] |
17 |
| - {:title (or title (string/capitalize (name network-name))) |
18 |
| - :blur? blur? |
19 |
| - :image :icon-avatar |
20 |
| - :image-props {:icon (resources/get-network network-name) |
21 |
| - :size :size-20} |
22 |
| - :action :selector |
23 |
| - :action-props {:type (if (= :default state) |
24 |
| - :filled-checkbox |
25 |
| - :checkbox) |
26 |
| - :customization-color color |
27 |
| - :checked? (contains? network-preferences network-name) |
28 |
| - :on-change on-change}}) |
29 |
| - |
30 | 12 | (defn- view-internal
|
31 | 13 | [{:keys [selected-networks watch-only?]}]
|
32 | 14 | (let [state (reagent/atom :default)
|
|
88 | 70 | [quo/category
|
89 | 71 | {:list-type :settings
|
90 | 72 | :blur? blur?
|
91 |
| - :data [(make-network-item mainnet |
92 |
| - {:state @state |
93 |
| - :title (i18n/label :t/mainnet) |
94 |
| - :color color |
95 |
| - :blur? blur? |
96 |
| - :network-preferences (get-current-preferences-names) |
97 |
| - :on-change #(toggle-network (:network-name |
98 |
| - mainnet))})]}] |
| 73 | + :data [(utils/make-network-item mainnet |
| 74 | + {:state @state |
| 75 | + :title (i18n/label :t/mainnet) |
| 76 | + :color color |
| 77 | + :blur? blur? |
| 78 | + :networks (get-current-preferences-names) |
| 79 | + :on-change #(toggle-network (:network-name |
| 80 | + mainnet))})]}] |
99 | 81 | [quo/category
|
100 | 82 | {:list-type :settings
|
101 | 83 | :blur? blur?
|
102 | 84 | :label (i18n/label :t/layer-2)
|
103 | 85 | :data (mapv (fn [network]
|
104 |
| - (make-network-item network |
105 |
| - {:state @state |
106 |
| - :color color |
107 |
| - :blur? blur? |
108 |
| - :network-preferences (get-current-preferences-names) |
109 |
| - :on-change #(toggle-network (:network-name |
110 |
| - network))})) |
| 86 | + (utils/make-network-item network |
| 87 | + {:state @state |
| 88 | + :color color |
| 89 | + :blur? blur? |
| 90 | + :networks (get-current-preferences-names) |
| 91 | + :on-change #(toggle-network (:network-name |
| 92 | + network))})) |
111 | 93 | layer-2-networks)}]
|
112 | 94 | [quo/bottom-actions
|
113 | 95 | {:actions :one-action
|
|
0 commit comments