[Fix] Activity Center Empty Community Icons (#15907)
Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
This commit is contained in:
parent
eea55b22d7
commit
3c9ad509cd
|
@ -4,6 +4,7 @@
|
||||||
[quo2.components.icon :as icons]
|
[quo2.components.icon :as icons]
|
||||||
[quo2.components.markdown.text :as text]
|
[quo2.components.markdown.text :as text]
|
||||||
[quo2.components.tags.context-tag.style :as style]
|
[quo2.components.tags.context-tag.style :as style]
|
||||||
|
[quo2.components.avatars.user-avatar.style :as user-avatar-style]
|
||||||
[react-native.core :as rn]))
|
[react-native.core :as rn]))
|
||||||
|
|
||||||
(defn trim-public-key
|
(defn trim-public-key
|
||||||
|
@ -39,16 +40,21 @@
|
||||||
(trim-public-key public-key)]])
|
(trim-public-key public-key)]])
|
||||||
|
|
||||||
(defn context-tag
|
(defn context-tag
|
||||||
[{:keys [text-style blur?] :as params} photo name channel-name]
|
[{:keys [text-style blur? no-avatar-placeholder?] :as params} photo name channel-name]
|
||||||
(let [text-params {:weight :medium
|
(let [text-params {:weight :medium
|
||||||
:size :paragraph-2
|
:size :paragraph-2
|
||||||
:style (assoc text-style :justify-content :center)}]
|
:style (assoc text-style :justify-content :center)}
|
||||||
|
empty-photo? (empty? photo)
|
||||||
|
avatar-size :xxs
|
||||||
|
avatar-outer-size (get-in user-avatar-style/sizes [avatar-size :outer])]
|
||||||
[base-tag (assoc-in params [:style :padding-left] 3)
|
[base-tag (assoc-in params [:style :padding-left] 3)
|
||||||
[user-avatar/user-avatar
|
(if (and empty-photo? no-avatar-placeholder?)
|
||||||
{:full-name name
|
[rn/view {:style {:width avatar-outer-size}}]
|
||||||
:profile-picture photo
|
[user-avatar/user-avatar
|
||||||
:size :xxs
|
{:full-name name
|
||||||
:status-indicator? false}]
|
:profile-picture photo
|
||||||
|
:size avatar-size
|
||||||
|
:status-indicator? false}])
|
||||||
[rn/view {:style style/context-tag-text-container}
|
[rn/view {:style style/context-tag-text-container}
|
||||||
[text/text text-params (str " " name)]
|
[text/text text-params (str " " name)]
|
||||||
(when channel-name
|
(when channel-name
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
:style {:width 40
|
:style {:width 40
|
||||||
:height 40}}]
|
:height 40}}]
|
||||||
(seq thumbnail-image)
|
(seq thumbnail-image)
|
||||||
[photos/photo thumbnail-image {:size 40}]
|
[photos/photo {:uri thumbnail-image} {:size 40}]
|
||||||
|
|
||||||
:else
|
:else
|
||||||
[chat-icon.screen/chat-icon-view-chat-list
|
[chat-icon.screen/chat-icon-view-chat-list
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
(ns status-im2.contexts.activity-center.notification.admin.view
|
(ns status-im2.contexts.activity-center.notification.admin.view
|
||||||
(:require [quo2.core :as quo]
|
(:require [quo2.core :as quo]
|
||||||
[quo2.foundations.colors :as colors]
|
|
||||||
[status-im2.constants :as constants]
|
[status-im2.constants :as constants]
|
||||||
[status-im2.contexts.activity-center.notification.common.style :as common-style]
|
[status-im2.contexts.activity-center.notification.common.style :as common-style]
|
||||||
[status-im2.contexts.activity-center.notification.common.view :as common]
|
[status-im2.contexts.activity-center.notification.common.view :as common]
|
||||||
|
@ -69,12 +68,8 @@
|
||||||
:context [[common/user-avatar-tag author]
|
:context [[common/user-avatar-tag author]
|
||||||
(i18n/label :t/wants-to-join)
|
(i18n/label :t/wants-to-join)
|
||||||
[quo/context-tag
|
[quo/context-tag
|
||||||
{:size :small
|
common/tag-params
|
||||||
:override-theme :dark
|
community-image community-name]]
|
||||||
:color colors/primary-50
|
|
||||||
:style common-style/user-avatar-tag
|
|
||||||
:text-style common-style/user-avatar-tag-text}
|
|
||||||
{:uri community-image} community-name]]
|
|
||||||
:items (case membership-status
|
:items (case membership-status
|
||||||
constants/activity-center-membership-status-accepted
|
constants/activity-center-membership-status-accepted
|
||||||
[{:type :status
|
[{:type :status
|
||||||
|
|
|
@ -9,11 +9,12 @@
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
(def tag-params
|
(def tag-params
|
||||||
{:size :small
|
{:size :small
|
||||||
:override-theme :dark
|
:override-theme :dark
|
||||||
:color colors/primary-50
|
:color colors/primary-50
|
||||||
:style style/user-avatar-tag
|
:style style/user-avatar-tag
|
||||||
:text-style style/user-avatar-tag-text})
|
:text-style style/user-avatar-tag-text
|
||||||
|
:no-avatar-placeholder? true})
|
||||||
|
|
||||||
(defn user-avatar-tag
|
(defn user-avatar-tag
|
||||||
[user-id]
|
[user-id]
|
||||||
|
|
|
@ -33,5 +33,5 @@
|
||||||
:unread? (not read)
|
:unread? (not read)
|
||||||
:context [[quo/text {:style common-style/user-avatar-tag-text}
|
:context [[quo/text {:style common-style/user-avatar-tag-text}
|
||||||
(i18n/label :t/community-kicked-body)]
|
(i18n/label :t/community-kicked-body)]
|
||||||
[quo/context-tag common/tag-params {:uri community-image}
|
[quo/context-tag common/tag-params community-image
|
||||||
community-name]]}]]))
|
community-name]]}]]))
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
[community membership-status]
|
[community membership-status]
|
||||||
(let [community-name (:name community)
|
(let [community-name (:name community)
|
||||||
community-image (get-in community [:images :thumbnail :uri])
|
community-image (get-in community [:images :thumbnail :uri])
|
||||||
community-context-tag [quo/context-tag common/tag-params {:uri community-image}
|
community-context-tag [quo/context-tag common/tag-params community-image
|
||||||
community-name]]
|
community-name]]
|
||||||
(cond
|
(cond
|
||||||
(= membership-status constants/activity-center-membership-status-idle)
|
(= membership-status constants/activity-center-membership-status-idle)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
(ns status-im2.contexts.activity-center.notification.mentions.view
|
(ns status-im2.contexts.activity-center.notification.mentions.view
|
||||||
(:require [clojure.string :as string]
|
(:require [clojure.string :as string]
|
||||||
[quo2.core :as quo]
|
[quo2.core :as quo]
|
||||||
[quo2.foundations.colors :as colors]
|
|
||||||
[react-native.gesture :as gesture]
|
[react-native.gesture :as gesture]
|
||||||
[status-im2.contexts.activity-center.notification.common.view :as common]
|
[status-im2.contexts.activity-center.notification.common.view :as common]
|
||||||
[status-im2.contexts.activity-center.notification.mentions.style :as style]
|
[status-im2.contexts.activity-center.notification.mentions.style :as style]
|
||||||
|
@ -9,13 +8,6 @@
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
(def ^:private tag-params
|
|
||||||
{:size :small
|
|
||||||
:override-theme :dark
|
|
||||||
:color colors/primary-50
|
|
||||||
:style style/tag
|
|
||||||
:text-style style/tag-text})
|
|
||||||
|
|
||||||
(defn- message-body
|
(defn- message-body
|
||||||
[message]
|
[message]
|
||||||
(let [parsed-text (get-in message [:content :parsed-text])
|
(let [parsed-text (get-in message [:content :parsed-text])
|
||||||
|
@ -68,6 +60,6 @@
|
||||||
:context [[common/user-avatar-tag author]
|
:context [[common/user-avatar-tag author]
|
||||||
[quo/text {:style style/tag-text} (string/lower-case (i18n/label :t/on))]
|
[quo/text {:style style/tag-text} (string/lower-case (i18n/label :t/on))]
|
||||||
(if community-chat?
|
(if community-chat?
|
||||||
[quo/context-tag tag-params {:uri community-image} community-name chat-name]
|
[quo/context-tag common/tag-params community-image community-name chat-name]
|
||||||
[quo/group-avatar-tag chat-name tag-params])]
|
[quo/group-avatar-tag chat-name common/tag-params])]
|
||||||
:message {:body (message-body message)}}]]]))
|
:message {:body (message-body message)}}]]]))
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
(ns status-im2.contexts.activity-center.notification.reply.view
|
(ns status-im2.contexts.activity-center.notification.reply.view
|
||||||
(:require [clojure.string :as string]
|
(:require [clojure.string :as string]
|
||||||
[quo2.core :as quo]
|
[quo2.core :as quo]
|
||||||
[quo2.foundations.colors :as colors]
|
|
||||||
[react-native.gesture :as gesture]
|
[react-native.gesture :as gesture]
|
||||||
[status-im.ui2.screens.chat.messages.message :as old-message]
|
[status-im.ui2.screens.chat.messages.message :as old-message]
|
||||||
[status-im2.common.not-implemented :as not-implemented]
|
[status-im2.common.not-implemented :as not-implemented]
|
||||||
|
@ -12,13 +11,6 @@
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
(def ^:private tag-params
|
|
||||||
{:size :small
|
|
||||||
:override-theme :dark
|
|
||||||
:color colors/primary-50
|
|
||||||
:style style/tag
|
|
||||||
:text-style style/tag-text})
|
|
||||||
|
|
||||||
;; NOTE: Replies support text, image and stickers only.
|
;; NOTE: Replies support text, image and stickers only.
|
||||||
(defn- get-message-content
|
(defn- get-message-content
|
||||||
[{:keys [content-type] :as message}]
|
[{:keys [content-type] :as message}]
|
||||||
|
@ -76,7 +68,7 @@
|
||||||
:context [[common/user-avatar-tag author]
|
:context [[common/user-avatar-tag author]
|
||||||
[quo/text {:style style/lowercase-text} (i18n/label :t/on)]
|
[quo/text {:style style/lowercase-text} (i18n/label :t/on)]
|
||||||
(if community-chat?
|
(if community-chat?
|
||||||
[quo/context-tag tag-params {:uri community-image} community-name chat-name]
|
[quo/context-tag common/tag-params community-image community-name chat-name]
|
||||||
[quo/group-avatar-tag chat-name tag-params])]
|
[quo/group-avatar-tag chat-name common/tag-params])]
|
||||||
:message {:body-number-of-lines 1
|
:message {:body-number-of-lines 1
|
||||||
:body (get-message-content message)}}]]]))
|
:body (get-message-content message)}}]]]))
|
||||||
|
|
|
@ -43,19 +43,27 @@
|
||||||
:type :boolean}])
|
:type :boolean}])
|
||||||
|
|
||||||
(def context-tag-descriptor
|
(def context-tag-descriptor
|
||||||
[{:label "Label"
|
[{:label "Show avatar"
|
||||||
|
:key :show-avatar?
|
||||||
|
:type :boolean}
|
||||||
|
{:label "Label"
|
||||||
:key :label
|
:key :label
|
||||||
:type :text}
|
:type :text}
|
||||||
{:label "Channel Name"
|
{:label "Channel name"
|
||||||
:key :channel-name
|
:key :channel-name
|
||||||
:type :text}])
|
:type :text}
|
||||||
|
{:label "Avatar placeholder"
|
||||||
|
:key :no-avatar-placeholder?
|
||||||
|
:type :boolean}])
|
||||||
|
|
||||||
(defn cool-preview
|
(defn cool-preview
|
||||||
[]
|
[]
|
||||||
(let [state (reagent/atom {:label "Name"
|
(let [state (reagent/atom {:label "Name"
|
||||||
:channel-name "Channel"
|
:channel-name "Channel"
|
||||||
:type :group-avatar
|
:type :group-avatar
|
||||||
:duration "00:32"})]
|
:duration "00:32"
|
||||||
|
:show-avatar? true
|
||||||
|
:no-avatar-placeholder? false})]
|
||||||
(fn []
|
(fn []
|
||||||
(let [contacts {example-pk {:public-key example-pk
|
(let [contacts {example-pk {:public-key example-pk
|
||||||
:primary-name "Automatic incompatible Coati"
|
:primary-name "Automatic incompatible Coati"
|
||||||
|
@ -122,10 +130,12 @@
|
||||||
:show-blur-background? (:blur? @state)}
|
:show-blur-background? (:blur? @state)}
|
||||||
(case (:type @state)
|
(case (:type @state)
|
||||||
:context-tag [quo2/context-tag
|
:context-tag [quo2/context-tag
|
||||||
{:blur? (:blur? @state)
|
{:blur? (:blur? @state)
|
||||||
:size :small
|
:size :small
|
||||||
:color :purple}
|
:color :purple
|
||||||
{:uri example-photo2}
|
:no-avatar-placeholder? (:no-avatar-placeholder? @state)}
|
||||||
|
(when (:show-avatar? @state)
|
||||||
|
example-photo2)
|
||||||
(:label @state)
|
(:label @state)
|
||||||
(:channel-name @state)]
|
(:channel-name @state)]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue