Skip to content

Commit cfc4830

Browse files
committed
Fix notification mark in group chats for no mentions
Also notification alignment styles in the component
1 parent 01736de commit cfc4830

File tree

2 files changed

+58
-26
lines changed

2 files changed

+58
-26
lines changed

src/status_im2/contexts/chat/home/chat_list_item/style.cljs

+24-8
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,31 @@
2121
:top 16
2222
:background-color (colors/theme-colors colors/neutral-40 colors/neutral-60)})
2323

24-
(def muted-icon
25-
{:position :absolute
26-
:right 19
27-
:top 16})
28-
2924
(defn timestamp
3025
[muted?]
31-
{:color (or (when muted?
32-
colors/neutral-50)
33-
(colors/theme-colors colors/neutral-50 colors/neutral-40))
26+
{:color (if muted?
27+
colors/neutral-50
28+
(colors/theme-colors colors/neutral-50 colors/neutral-40))
3429
:margin-top 3
3530
:margin-left 8})
31+
32+
(def chat-data-container
33+
{:flex 1
34+
:margin-left 8
35+
:margin-right 16})
36+
37+
(def notification-container
38+
{:margin-left :auto
39+
:height 20
40+
:width 20
41+
:justify-content :center
42+
:align-items :center})
43+
44+
;; TODO: duplicate of `quo2.components.common.unread-grey-dot.style`
45+
;; Replace it when this component is defined as part of `quo2.components`
46+
(defn grey-dot
47+
[]
48+
{:width 8
49+
:height 8
50+
:border-radius 4
51+
:background-color (colors/theme-colors colors/neutral-40 colors/neutral-60)})

src/status_im2/contexts/chat/home/chat_list_item/view.cljs

+34-18
Original file line numberDiff line numberDiff line change
@@ -208,16 +208,40 @@
208208
{:color color
209209
:size :medium}]))
210210

211+
(defn notification
212+
[{:keys [muted group-chat unviewed-messages-count unviewed-mentions-count]}]
213+
(let [customization-color (rf/sub [:profile/customization-color])
214+
unread-messages? (> unviewed-messages-count 0)
215+
unread-mentions? (> unviewed-mentions-count 0)]
216+
[rn/view {:style style/notification-container}
217+
(cond
218+
muted
219+
[icons/icon :i/muted {:color colors/neutral-40}]
220+
221+
(and group-chat unread-mentions?)
222+
[quo/info-count
223+
{:style {:position :relative :right 0}
224+
:customization-color customization-color}
225+
unviewed-mentions-count]
226+
227+
;; TODO: use the grey-dot component when chat-list-item is moved to quo2.components
228+
(and group-chat unread-messages?)
229+
[rn/view {:style (style/grey-dot)}]
230+
231+
unread-messages?
232+
[quo/info-count
233+
{:style {:position :relative :right 0}
234+
:customization-color customization-color}
235+
unviewed-messages-count])]))
236+
211237
(defn chat-list-item
212-
[{:keys [chat-id group-chat color name unviewed-messages-count
213-
timestamp last-message muted]
238+
[{:keys [chat-id group-chat color name timestamp last-message muted]
214239
:as item}]
215-
(let [display-name (if group-chat
216-
name
217-
(first (rf/sub [:contacts/contact-two-names-by-identity chat-id])))
218-
contact (when-not group-chat
219-
(rf/sub [:contacts/contact-by-address chat-id]))
220-
show-unread-badge? (and (not muted) (> unviewed-messages-count 0))]
240+
(let [display-name (if group-chat
241+
name
242+
(first (rf/sub [:contacts/contact-two-names-by-identity chat-id])))
243+
contact (when-not group-chat
244+
(rf/sub [:contacts/contact-by-address chat-id]))]
221245
[rn/touchable-opacity
222246
{:style (style/container)
223247
:on-press (open-chat chat-id)
@@ -229,15 +253,7 @@
229253
:full-name display-name
230254
:color color
231255
:muted? muted}]
232-
[rn/view {:style {:margin-left 8}}
256+
[rn/view {:style style/chat-data-container}
233257
[name-view display-name contact timestamp muted]
234258
[last-message-preview group-chat last-message muted]]
235-
(if-not muted
236-
(when show-unread-badge?
237-
[quo/info-count
238-
{:style {:top 16
239-
:right 16}}
240-
unviewed-messages-count])
241-
[icons/icon :i/muted
242-
{:color colors/neutral-40
243-
:container-style style/muted-icon}])]))
259+
[notification item]]))

0 commit comments

Comments
 (0)