File tree 2 files changed +39
-31
lines changed
quo2/components/notifications/toast
status_im2/contexts/activity_center
2 files changed +39
-31
lines changed Original file line number Diff line number Diff line change 1
1
(ns quo2.components.notifications.toast.view
2
- (:require [quo2.components.icon :as icon]
2
+ (:require [quo2.components.avatars.user-avatar.view :as user-avatar]
3
+ [quo2.components.icon :as icon]
3
4
[quo2.components.markdown.text :as text]
4
5
[quo2.components.notifications.count-down-circle :as count-down-circle]
5
6
[quo2.components.notifications.toast.style :as style]
60
61
61
62
(defn toast
62
63
[{:keys [icon icon-color title text action undo-duration undo-on-press container-style
63
- override-theme]}]
64
+ override-theme user ]}]
64
65
[toast-container
65
- {:left (when icon
66
- [icon/icon icon
67
- (cond-> (style/icon override-theme)
68
- icon-color
69
- (assoc :color icon-color))])
66
+ {:left (cond icon
67
+ [icon/icon icon
68
+ (cond-> (style/icon override-theme)
69
+ icon-color
70
+ (assoc :color icon-color))]
71
+
72
+ user
73
+ [user-avatar/user-avatar user])
70
74
:title title
71
75
:text text
72
76
:right (if undo-duration
Original file line number Diff line number Diff line change 532
532
[{:keys [db]} new-notifications]
533
533
(let [my-public-key (get-in db [:multiaccount :public-key ])]
534
534
(reduce (fn [cofx {:keys [author type accepted dismissed message name] :as x}]
535
- (cond
536
- (and (not= author my-public-key)
537
- (= type types/contact-request)
538
- (not accepted)
539
- (not dismissed))
540
- (toasts/upsert cofx
541
- {:icon :placeholder
542
- :icon-color colors/primary-50-opa-40
543
- :title (i18n/label :t/contact-request-sent-toast
544
- {:name name})
545
- :text (get-in message [:content :text ])})
546
-
547
- (and (= author my-public-key) ; ; we show it for user who sent the request
548
- (= type types/contact-request)
549
- accepted
550
- (not dismissed))
551
- (toasts/upsert cofx
552
- {:icon :placeholder
553
- :icon-color colors/primary-50-opa-40
554
- :title (i18n/label :t/contact-request-accepted-toast
555
- {:name (or name (:alias message))})})
556
-
557
- :else
558
- cofx))
535
+ (let [user-avatar {:full-name name
536
+ :status-indicator? true
537
+ :online? nil
538
+ :size :small
539
+ :ring? false }]
540
+ (cond
541
+ (and (not= author my-public-key)
542
+ (= type types/contact-request)
543
+ (not accepted)
544
+ (not dismissed))
545
+ (toasts/upsert cofx
546
+ {:user user-avatar
547
+ :icon-color colors/primary-50-opa-40
548
+ :title (i18n/label :t/contact-request-sent-toast
549
+ {:name name})
550
+ :text (get-in message [:content :text ])})
551
+
552
+ (and (= author my-public-key) ; ; we show it for user who sent the request
553
+ (= type types/contact-request)
554
+ accepted
555
+ (not dismissed))
556
+ (toasts/upsert cofx
557
+ {:user user-avatar
558
+ :icon-color colors/success-50-opa-40
559
+ :title (i18n/label :t/contact-request-accepted-toast
560
+ {:name (or name (:alias message))})})
561
+ :else
562
+ cofx)))
559
563
{:db db}
560
564
new-notifications)))
You can’t perform that action at this time.
0 commit comments