Skip to content

Commit

Permalink
show basic network preferences bottom sheet, still wip
Browse files Browse the repository at this point in the history
  • Loading branch information
briansztamfater committed Apr 17, 2024
1 parent 20ad5c6 commit 1d7e2a0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
25 changes: 21 additions & 4 deletions src/status_im/contexts/wallet/send/input_amount/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
[utils.debounce :as debounce]
[utils.i18n :as i18n]
[utils.re-frame :as rf]
[quo.foundations.colors :as colors]))
[quo.foundations.colors :as colors]
[status-im.contexts.wallet.sheets.network-preferences.view :as network-preferences]))

(defn- make-limit-label
[{:keys [amount currency]}]
Expand Down Expand Up @@ -137,8 +138,24 @@
(rf/dispatch [:wallet/edit-token-to-send token])
(clear-input!))}]]))

(defn- open-preferences
[selected-networks account]
(rf/dispatch
[:show-bottom-sheet
{:content (fn []
[network-preferences/view
{:title (i18n/label :t/edit-receiver-networks)
:section-one-title (i18n/label :t/preferred-by-receiver)
:section-two-title (i18n/label :t/not-preferred-by-receiver)
:selected-networks (vec (map utils/id->network selected-networks))
:account account
:button-label (i18n/label :t/display)
:on-save (fn [chain-ids]
(rf/dispatch [:hide-bottom-sheet])
(rf/dispatch [:wallet/update-receiver-networks chain-ids]))}])}]))

(defn- token-not-available
[token-symbol]
[token-symbol selected-networks address]
[rn/view {:style style/token-not-available-container}
[rn/view
[quo/icon :i/alert
Expand All @@ -152,7 +169,7 @@
[quo/button
{:size 24
:customization-color colors/danger-50
:on-press #()}
:on-press #(open-preferences selected-networks address)}
(i18n/label :t/add-networks-token-can-be-sent-to {:token-symbol token-symbol})]]])

(defn- f-view-internal
Expand Down Expand Up @@ -376,7 +393,7 @@
(rf/dispatch [:wallet/disable-from-networks
disabled-chain-ids]))))}]
(when token-not-supported-in-receiver-networks?
[token-not-available token-symbol])
[token-not-available token-symbol selected-networks to-address])
(when (or loading-routes? (seq route))
[estimated-fees
{:loading-suggested-routes? loading-routes?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
[utils.re-frame :as rf]))

(defn- view-internal
[{:keys [selected-networks account watch-only?]}]
[{:keys [title section-one-title section-two-title selected-networks account watch-only?]}]
(println selected-networks "4324233")
(let [state (reagent/atom :default)
{:keys [color address
network-preferences-names]} (or account (rf/sub [:wallet/current-viewing-account]))
Expand Down Expand Up @@ -50,7 +51,7 @@
:blur-amount 20
:blur-radius 25}])
[quo/drawer-top
{:title (i18n/label :t/network-preferences)
{:title (or title (i18n/label :t/network-preferences))
:description (if watch-only?
(i18n/label :t/network-preferences-desc-1)
(i18n/label :t/network-preferences-desc-2))
Expand Down

0 comments on commit 1d7e2a0

Please sign in to comment.