Pinned messages drawer comments (#16998)
This commit is contained in:
parent
3162e2dd3e
commit
9ab1b70e0e
|
@ -1,8 +1,10 @@
|
||||||
(ns status-im2.contexts.chat.menus.pinned-messages.style
|
(ns status-im2.contexts.chat.menus.pinned-messages.style
|
||||||
(:require [quo2.foundations.colors :as colors]))
|
(:require [quo2.foundations.colors :as colors]))
|
||||||
|
|
||||||
(def heading
|
(defn heading
|
||||||
{:margin-horizontal 20})
|
[community?]
|
||||||
|
{:margin-horizontal 20
|
||||||
|
:margin-bottom (when-not community? 24)})
|
||||||
|
|
||||||
(defn heading-container
|
(defn heading-container
|
||||||
[]
|
[]
|
||||||
|
|
|
@ -8,10 +8,18 @@
|
||||||
[status-im2.contexts.chat.menus.pinned-messages.style :as style]
|
[status-im2.contexts.chat.menus.pinned-messages.style :as style]
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
[utils.re-frame :as rf]
|
[utils.re-frame :as rf]
|
||||||
[react-native.gesture :as gesture]))
|
[react-native.gesture :as gesture]
|
||||||
|
[react-native.fast-image :as fast-image]))
|
||||||
|
|
||||||
(def list-key-fn #(or (:message-id %) (:value %)))
|
(def list-key-fn #(or (:message-id %) (:value %)))
|
||||||
|
|
||||||
|
(defn community-avatar
|
||||||
|
[community-images]
|
||||||
|
(when community-images
|
||||||
|
(:uri (or (:thumbnail community-images)
|
||||||
|
(:large community-images)
|
||||||
|
(first community-images)))))
|
||||||
|
|
||||||
(defn message-render-fn
|
(defn message-render-fn
|
||||||
[{:keys [deleted? deleted-for-me?] :as message} _ _ context]
|
[{:keys [deleted? deleted-for-me?] :as message} _ _ context]
|
||||||
(if (or deleted? deleted-for-me?)
|
(if (or deleted? deleted-for-me?)
|
||||||
|
@ -25,17 +33,23 @@
|
||||||
current-chat (rf/sub [:chat-by-id chat-id])
|
current-chat (rf/sub [:chat-by-id chat-id])
|
||||||
{:keys [community-id]} current-chat
|
{:keys [community-id]} current-chat
|
||||||
community (rf/sub [:communities/community community-id])
|
community (rf/sub [:communities/community community-id])
|
||||||
bottom-inset (safe-area/get-bottom)]
|
bottom-inset (safe-area/get-bottom)
|
||||||
|
community-images (rf/sub [:community/images community-id])]
|
||||||
[gesture/scroll-view
|
[gesture/scroll-view
|
||||||
{:accessibility-label :pinned-messages-menu}
|
{:accessibility-label :pinned-messages-menu}
|
||||||
[:<>
|
[:<>
|
||||||
[quo/text
|
[quo/text
|
||||||
{:size :heading-1
|
{:size :heading-2
|
||||||
:weight :semi-bold
|
:weight :semi-bold
|
||||||
:style style/heading}
|
:style (style/heading community)}
|
||||||
(i18n/label :t/pinned-messages)]
|
(i18n/label :t/pinned-messages)]
|
||||||
(when community
|
(when community
|
||||||
[rn/view {:style (style/heading-container)}
|
[rn/view {:style (style/heading-container)}
|
||||||
|
[fast-image/fast-image
|
||||||
|
{:source (community-avatar community-images)
|
||||||
|
:style {:width 20
|
||||||
|
:height 20
|
||||||
|
:border-radius 20}}]
|
||||||
[rn/text {:style (style/heading-text)} (:name community)]
|
[rn/text {:style (style/heading-text)} (:name community)]
|
||||||
[quo/icon
|
[quo/icon
|
||||||
:i/chevron-right
|
:i/chevron-right
|
||||||
|
|
|
@ -297,3 +297,9 @@
|
||||||
token_criteria
|
token_criteria
|
||||||
(or check-criteria token_criteria))))
|
(or check-criteria token_criteria))))
|
||||||
token-permissions)}))
|
token-permissions)}))
|
||||||
|
|
||||||
|
(re-frame/reg-sub
|
||||||
|
:community/images
|
||||||
|
:<- [:communities]
|
||||||
|
(fn [communities [_ id]]
|
||||||
|
(get-in communities [id :images])))
|
||||||
|
|
Loading…
Reference in New Issue