Skip to content

Commit 1aef310

Browse files
authored
Fix chat UI element colors (#18941)
* chore: add community color subscription * fix: use configured chat color for chat ui and fallback to community color * test: ensure community-color subscription returns the community color * tidy: use resolve-color function instead of custom-color function * revise: rename community-color to customization-color and default non-community channel color to turquoise
1 parent a4b9739 commit 1aef310

File tree

4 files changed

+27
-8
lines changed

4 files changed

+27
-8
lines changed

Diff for: src/status_im/contexts/chat/messenger/messages/list/view.cljs

+11-6
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
muted?)))}]}]))
168168

169169
(defn f-list-footer
170-
[{:keys [chat distance-from-list-top cover-bg-color theme]}]
170+
[{:keys [chat distance-from-list-top theme customization-color]}]
171171
(let [{:keys [chat-id chat-name emoji chat-type
172172
group-chat]} chat
173173
display-name (cond
@@ -185,8 +185,8 @@
185185
messages.constants/top-bar-height
186186
messages.constants/header-container-top-margin)
187187
background-color (colors/theme-colors
188-
(colors/custom-color cover-bg-color 50 20)
189-
(colors/custom-color cover-bg-color 50 40)
188+
(colors/resolve-color customization-color theme 20)
189+
(colors/resolve-color customization-color theme 40)
190190
theme)
191191
border-radius (reanimated/interpolate
192192
distance-from-list-top
@@ -224,7 +224,7 @@
224224
(when bio
225225
[quo/text {:style style/bio}
226226
bio])
227-
[actions chat-id cover-bg-color]]]))
227+
[actions chat-id customization-color]]]))
228228

229229
(defn list-footer
230230
[props]
@@ -285,10 +285,15 @@
285285
(reset! distance-atom new-distance)))
286286

287287
(defn f-messages-list-content
288-
[{:keys [insets distance-from-list-top content-height layout-height cover-bg-color distance-atom
288+
[{:keys [insets distance-from-list-top content-height layout-height distance-atom
289289
chat-screen-layout-calculations-complete? chat-list-scroll-y]}]
290290
(let [theme (quo.theme/use-theme-value)
291291
chat (rf/sub [:chats/current-chat-chat-view])
292+
community-channel? (= constants/community-chat-type (:chat-type chat))
293+
customization-color (if community-channel?
294+
(or (:color chat)
295+
(rf/sub [:communities/community-color (:community-id chat)]))
296+
:turquoise)
292297
{:keys [keyboard-shown]} (hooks/use-keyboard)
293298
{window-height :height} (rn/get-window)
294299
context (rf/sub [:chats/current-chat-message-list-view-context])
@@ -310,7 +315,7 @@
310315
:chat chat
311316
:window-height window-height
312317
:distance-from-list-top distance-from-list-top
313-
:cover-bg-color cover-bg-color}]
318+
:customization-color customization-color}]
314319
:data messages
315320
:render-data {:theme theme
316321
:context context

Diff for: src/status_im/contexts/chat/messenger/messages/view.cljs

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@
3434
:distance-atom distance-atom
3535
:chat-screen-layout-calculations-complete? chat-screen-layout-calculations-complete?
3636
:distance-from-list-top distance-from-list-top
37-
:chat-list-scroll-y chat-list-scroll-y
38-
:cover-bg-color :turquoise}]
37+
:chat-list-scroll-y chat-list-scroll-y}]
3938
[composer.view/composer
4039
{:insets insets
4140
:chat-screen-layout-calculations-complete? chat-screen-layout-calculations-complete?

Diff for: src/status_im/subs/communities.cljs

+6
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
(fn [communities [_ id]]
3737
(get-in communities [id :chats])))
3838

39+
(re-frame/reg-sub
40+
:communities/community-color
41+
:<- [:communities]
42+
(fn [communities [_ id]]
43+
(get-in communities [id :color])))
44+
3945
(re-frame/reg-sub
4046
:communities/community-members
4147
:<- [:communities]

Diff for: src/status_im/subs/communities_test.cljs

+9
Original file line numberDiff line numberDiff line change
@@ -496,3 +496,12 @@
496496
:network-preferences-names #{}
497497
:name "account3"}]
498498
(rf/sub [sub-name community-id])))))
499+
500+
(h/deftest-sub :communities/community-color
501+
[sub-name]
502+
(testing "returns the community color"
503+
(let [community-color "#FEFEFE"]
504+
(swap! rf-db/app-db assoc
505+
:communities
506+
{community-id {:color community-color}})
507+
(is (match? community-color (rf/sub [sub-name community-id]))))))

0 commit comments

Comments
 (0)