Skip to content

Commit

Permalink
refactor: show-user-info? -> in-reaction-and-action-menu? in msg content
Browse files Browse the repository at this point in the history
Signed-off-by: yqrashawn <namy.19@gmail.com>
  • Loading branch information
yqrashawn committed Oct 5, 2023
1 parent 2de3497 commit 1ccf4a5
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions src/status_im2/contexts/chat/messages/content/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,17 @@

(defn avatar-container
[{:keys [content last-in-group? pinned-by quoted-message from]} show-reactions?
show-user-info? in-pinned-view?]
in-reaction-and-action-menu? in-pinned-view?]
(if (or (and (seq (:response-to content))
quoted-message)
last-in-group?
pinned-by
(not show-reactions?)
show-user-info?)
[avatar/avatar {:public-key from :size :small :hide-ring? (or in-pinned-view? show-user-info?)}]
in-reaction-and-action-menu?)
[avatar/avatar
{:public-key from
:size :small
:hide-ring? (or in-pinned-view? in-reaction-and-action-menu?)}]
[rn/view {:padding-top 2 :width 32}]))

(defn author
Expand All @@ -51,12 +54,12 @@
from
timestamp]}
show-reactions?
show-user-info?]
in-reaction-and-action-menu?]
(when (or (and (seq response-to) quoted-message)
last-in-group?
pinned-by
(not show-reactions?)
show-user-info?)
in-reaction-and-action-menu?)
(let [[primary-name secondary-name] (rf/sub [:contacts/contact-two-names-by-identity from])
{:keys [ens-verified added?]} (rf/sub [:contacts/contact-by-address from])]
[quo/author
Expand Down Expand Up @@ -112,7 +115,8 @@
(defn- user-message-content-internal
[]
(let [show-delivery-state? (reagent/atom false)]
(fn [{:keys [message-data context keyboard-shown? show-reactions? show-user-info? theme]}]
(fn [{:keys [message-data context keyboard-shown? show-reactions? in-reaction-and-action-menu?
theme]}]
(let [{:keys [content-type quoted-message content
outgoing outgoing-status pinned-by]} message-data
first-image (first (:album message-data))
Expand Down Expand Up @@ -164,7 +168,8 @@
[rn/view
{:style {:padding-horizontal 4
:flex-direction :row}}
[avatar-container message-data show-reactions? show-user-info? (:in-pinned-view? context)]
[avatar-container message-data show-reactions? in-reaction-and-action-menu?
(:in-pinned-view? context)]
(into
(if show-reactions?
[rn/view]
Expand All @@ -173,7 +178,7 @@
:flex 1
:max-height (when-not show-reactions?
(* 0.4 height))}}
[author message-data show-reactions? show-user-info?]
[author message-data show-reactions? in-reaction-and-action-menu?]
(case content-type

constants/content-type-text
Expand Down Expand Up @@ -220,11 +225,11 @@
:selected-item (fn []
[rn/view {:pointer-events :none}
[user-message-content
{:message-data message-data
:context context
:keyboard-shown? keyboard-shown?
:show-reactions? true
:show-user-info? true}]])}]))
{:message-data message-data
:context context
:keyboard-shown? keyboard-shown?
:show-reactions? true
:in-reaction-and-action-menu? true}]])}]))

(defn system-message?
[content-type]
Expand Down

0 comments on commit 1ccf4a5

Please sign in to comment.