Skip to content

Commit

Permalink
Add :wallet/accounts-with-customization-color subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
ajayesivan committed Dec 26, 2023
1 parent 0b4a154 commit 2f3e4d2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions src/status_im/subs/wallet/wallet.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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)))

0 comments on commit 2f3e4d2

Please sign in to comment.