feat(wallet): Remove non operable accounts from account switcher
This commit is contained in:
parent
435bf3dbd5
commit
9a6fa2c2ab
|
@ -108,8 +108,9 @@
|
|||
[]
|
||||
(let [options-height (reagent/atom 0)]
|
||||
(fn []
|
||||
(let [theme (quo.theme/use-theme)
|
||||
accounts (rf/sub [:wallet/accounts-without-current-viewing-account])
|
||||
(let [theme (quo.theme/use-theme)
|
||||
accounts (rf/sub
|
||||
[:wallet/fully-or-partially-operable-accounts-without-current-viewing-account])
|
||||
show-account-selector? (pos? (count accounts))]
|
||||
[:<>
|
||||
(when show-account-selector?
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
(defn view
|
||||
[]
|
||||
(let [selected-account-address (rf/sub [:wallet/current-viewing-account-address])
|
||||
accounts (rf/sub [:wallet/accounts-without-watched-accounts])]
|
||||
accounts (rf/sub [:wallet/fully-or-partially-operable-accounts-without-watched-accounts])]
|
||||
[:<>
|
||||
[quo/drawer-top {:title (i18n/label :t/select-account)}]
|
||||
[gesture/flat-list
|
||||
|
|
|
@ -422,6 +422,22 @@
|
|||
(fn [accounts]
|
||||
(remove :watch-only? accounts)))
|
||||
|
||||
(defn- keep-fully-or-partially-operable-accounts
|
||||
[accounts]
|
||||
(filter (fn fully-or-partially-operable? [{:keys [operable]}]
|
||||
(#{:fully :partially} operable))
|
||||
accounts))
|
||||
|
||||
(rf/reg-sub
|
||||
:wallet/fully-or-partially-operable-accounts-without-current-viewing-account
|
||||
:<- [:wallet/accounts-without-current-viewing-account]
|
||||
keep-fully-or-partially-operable-accounts)
|
||||
|
||||
(rf/reg-sub
|
||||
:wallet/fully-or-partially-operable-accounts-without-watched-accounts
|
||||
:<- [:wallet/accounts-without-watched-accounts]
|
||||
keep-fully-or-partially-operable-accounts)
|
||||
|
||||
(rf/reg-sub
|
||||
:wallet/accounts-with-current-asset
|
||||
:<- [:wallet/accounts-without-watched-accounts]
|
||||
|
|
Loading…
Reference in New Issue