|
208 | 208 | {:color color
|
209 | 209 | :size :medium}]))
|
210 | 210 |
|
| 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 | + |
211 | 237 | (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] |
214 | 239 | :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]))] |
221 | 245 | [rn/touchable-opacity
|
222 | 246 | {:style (style/container)
|
223 | 247 | :on-press (open-chat chat-id)
|
|
229 | 253 | :full-name display-name
|
230 | 254 | :color color
|
231 | 255 | :muted? muted}]
|
232 |
| - [rn/view {:style {:margin-left 8}} |
| 256 | + [rn/view {:style style/chat-data-container} |
233 | 257 | [name-view display-name contact timestamp muted]
|
234 | 258 | [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