-
Notifications
You must be signed in to change notification settings - Fork 984
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* [#21557] feat: show from account page in swap flow * [#21557] feat: add disabled state to account-item * [#21557] fix: apply suggestion * [#21557] fix: add format address util and rename screen * [#21557] fix: check and count account with token balance * [#21557] fix: check for root screen
- Loading branch information
1 parent
26ae330
commit 21c2a52
Showing
12 changed files
with
242 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
(ns status-im.contexts.wallet.swap.select-account.style) | ||
|
||
(def accounts-list | ||
{:padding-bottom 12}) | ||
|
||
(def accounts-list-container | ||
{:padding-horizontal 8}) |
52 changes: 52 additions & 0 deletions
52
src/status_im/contexts/wallet/swap/select_account/view.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
(ns status-im.contexts.wallet.swap.select-account.view | ||
(:require | ||
[quo.core :as quo] | ||
[react-native.core :as rn] | ||
[react-native.safe-area :as safe-area] | ||
[status-im.common.events-helper :as events-helper] | ||
[status-im.common.floating-button-page.view :as floating-button-page] | ||
[status-im.contexts.wallet.swap.select-account.style :as style] | ||
[utils.i18n :as i18n] | ||
[utils.money :as money] | ||
[utils.re-frame :as rf])) | ||
|
||
(defn- on-account-press | ||
[account] | ||
(rf/dispatch [:wallet.swap/start-from-account account])) | ||
|
||
(defn- render-fn | ||
[item _ _] | ||
(let [has-balance (money/above-zero? (:asset-pay-balance item))] | ||
[quo/account-item | ||
{:type (if has-balance :tag :default) | ||
:on-press #(on-account-press item) | ||
:state (if has-balance :default :disabled) | ||
:token-props {:symbol (:asset-pay-symbol item) | ||
:value (:asset-pay-balance item)} | ||
:account-props (assoc item | ||
:address (:formatted-address item) | ||
:full-address? true)}])) | ||
|
||
(defn- on-close | ||
[] | ||
(rf/dispatch [:wallet/clean-current-viewing-account]) | ||
(events-helper/navigate-back)) | ||
|
||
(defn view | ||
[] | ||
(let [accounts (rf/sub [:wallet/accounts-with-balances])] | ||
[floating-button-page/view | ||
{:footer-container-padding 0 | ||
:header [quo/page-nav | ||
{:margin-top (safe-area/get-top) | ||
:icon-name :i/close | ||
:on-press on-close}]} | ||
[quo/page-top | ||
{:title (i18n/label :t/from-label) | ||
:title-accessibility-label :title-label}] | ||
[rn/flat-list | ||
{:style style/accounts-list | ||
:content-container-style style/accounts-list-container | ||
:data accounts | ||
:render-fn render-fn | ||
:shows-horizontal-scroll-indicator false}]])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.