Add :wallet/accounts-with-customization-color subscription (#18302)

This commit is contained in:
Ajay Sivan 2023-12-26 21:42:20 +05:30 committed by GitHub
parent 0b4a1545ae
commit bec51b7d0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 13 deletions

View File

@ -36,10 +36,7 @@
[]
(let [{id :community-id} (rf/sub [:get-screen-params])
{:keys [name color images]} (rf/sub [:communities/community id])
accounts (->> (rf/sub [:wallet])
:accounts
vals
(map #(assoc % :customization-color (:color %))))]
accounts (rf/sub [:wallet/accounts-with-customization-color])]
[rn/view {:style style/container}
[quo/page-nav
{:text-align :left

View File

@ -24,10 +24,7 @@
[]
(let [{id :community-id} (rf/sub [:get-screen-params])
{:keys [name color images]} (rf/sub [:communities/community id])
accounts (->> (rf/sub [:wallet])
:accounts
vals
(map #(assoc % :customization-color (:color %))))]
accounts (rf/sub [:wallet/accounts-with-customization-color])]
[rn/safe-area-view {:style style/container}
[quo/drawer-top
@ -42,7 +39,7 @@
[rn/flat-list
{:render-fn account-item
:content-container-style {:padding 20}
:key-fn :key-uid
:key-fn :address
:data accounts}]
[rn/view {:style style/buttons}

View File

@ -27,10 +27,7 @@
(let [{id :community-id} (rf/sub [:get-screen-params])
{:keys [name images color]} (rf/sub [:communities/community id])
logo-uri (get-in images [:thumbnail :uri])
accounts (->> (rf/sub [:wallet])
:accounts
vals
(map #(assoc % :customization-color (:color %))))]
accounts (rf/sub [:wallet/accounts-with-customization-color])]
[:<>
[quo/drawer-top
{:type :context-tag

View File

@ -198,3 +198,11 @@
(fn [[current-viewing-account network-details]]
(let [network-preferences-names (:network-preferences-names current-viewing-account)]
(filter #(contains? network-preferences-names (:network-name %)) network-details))))
(rf/reg-sub
:wallet/accounts-with-customization-color
:<- [:wallet/accounts]
(fn [accounts]
(map (fn [{:keys [color] :as account}]
(assoc account :customization-color color))
accounts)))