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

View File

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

View File

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

View File

@ -198,3 +198,11 @@
(fn [[current-viewing-account network-details]] (fn [[current-viewing-account network-details]]
(let [network-preferences-names (:network-preferences-names current-viewing-account)] (let [network-preferences-names (:network-preferences-names current-viewing-account)]
(filter #(contains? network-preferences-names (:network-name %)) network-details)))) (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)))