feat(wallet): Remove non operable accounts from account switcher

This commit is contained in:
Ulises M 2024-06-13 14:09:37 -06:00
parent 435bf3dbd5
commit 9a6fa2c2ab
No known key found for this signature in database
GPG Key ID: 5A15782EB758534E
3 changed files with 20 additions and 3 deletions

View File

@ -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?

View File

@ -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

View File

@ -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]