Pinned messages drawer comments (#16998)

This commit is contained in:
Ibrahem Khalil 2023-08-30 16:04:08 +03:00 committed by GitHub
parent 3162e2dd3e
commit 9ab1b70e0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 6 deletions

View File

@ -1,8 +1,10 @@
(ns status-im2.contexts.chat.menus.pinned-messages.style
(:require [quo2.foundations.colors :as colors]))
(def heading
{:margin-horizontal 20})
(defn heading
[community?]
{:margin-horizontal 20
:margin-bottom (when-not community? 24)})
(defn heading-container
[]

View File

@ -8,10 +8,18 @@
[status-im2.contexts.chat.menus.pinned-messages.style :as style]
[utils.i18n :as i18n]
[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 %)))
(defn community-avatar
[community-images]
(when community-images
(:uri (or (:thumbnail community-images)
(:large community-images)
(first community-images)))))
(defn message-render-fn
[{:keys [deleted? deleted-for-me?] :as message} _ _ context]
(if (or deleted? deleted-for-me?)
@ -25,17 +33,23 @@
current-chat (rf/sub [:chat-by-id chat-id])
{:keys [community-id]} current-chat
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
{:accessibility-label :pinned-messages-menu}
[:<>
[quo/text
{:size :heading-1
{:size :heading-2
:weight :semi-bold
:style style/heading}
:style (style/heading community)}
(i18n/label :t/pinned-messages)]
(when community
[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)]
[quo/icon
:i/chevron-right

View File

@ -297,3 +297,9 @@
token_criteria
(or check-criteria token_criteria))))
token-permissions)}))
(re-frame/reg-sub
:community/images
:<- [:communities]
(fn [communities [_ id]]
(get-in communities [id :images])))