fix: several bugs in 1.25 design feedback (#17548)

This commit is contained in:
yqrashawn 2023-10-06 15:32:33 +08:00 committed by GitHub
parent 933a5a1a9e
commit afbd890a04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 15 deletions

View File

@ -4,7 +4,7 @@
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
(defn avatar (defn avatar
[public-key size] [{:keys [public-key size hide-ring?]}]
(let [display-name (first (rf/sub [:contacts/contact-two-names-by-identity public-key])) (let [display-name (first (rf/sub [:contacts/contact-two-names-by-identity public-key]))
photo-path (rf/sub [:chats/photo-path public-key]) photo-path (rf/sub [:chats/photo-path public-key])
online? (rf/sub [:visibility-status-updates/online? public-key])] online? (rf/sub [:visibility-status-updates/online? public-key])]
@ -14,6 +14,7 @@
:on-press #(rf/dispatch [:chat.ui/show-profile public-key])} :on-press #(rf/dispatch [:chat.ui/show-profile public-key])}
[quo/user-avatar [quo/user-avatar
{:full-name display-name {:full-name display-name
:ring? (not hide-ring?)
:profile-picture photo-path :profile-picture photo-path
:online? online? :online? online?
:size size}]]])) :size size}]]]))

View File

@ -31,14 +31,18 @@
(def delivery-state-showing-time-ms 3000) (def delivery-state-showing-time-ms 3000)
(defn avatar-container (defn avatar-container
[{:keys [content last-in-group? pinned-by quoted-message from]} show-reactions? show-user-info?] [{:keys [content last-in-group? pinned-by quoted-message from]} show-reactions?
in-reaction-and-action-menu? in-pinned-view?]
(if (or (and (seq (:response-to content)) (if (or (and (seq (:response-to content))
quoted-message) quoted-message)
last-in-group? last-in-group?
pinned-by pinned-by
(not show-reactions?) (not show-reactions?)
show-user-info?) in-reaction-and-action-menu?)
[avatar/avatar from :small] [avatar/avatar
{:public-key from
:size :small
:hide-ring? (or in-pinned-view? in-reaction-and-action-menu?)}]
[rn/view {:padding-top 4 :width 32}])) [rn/view {:padding-top 4 :width 32}]))
(defn author (defn author
@ -50,12 +54,12 @@
from from
timestamp]} timestamp]}
show-reactions? show-reactions?
show-user-info?] in-reaction-and-action-menu?]
(when (or (and (seq response-to) quoted-message) (when (or (and (seq response-to) quoted-message)
last-in-group? last-in-group?
pinned-by pinned-by
(not show-reactions?) (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]) (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])] {:keys [ens-verified added?]} (rf/sub [:contacts/contact-by-address from])]
[quo/author [quo/author
@ -111,7 +115,8 @@
(defn- user-message-content-internal (defn- user-message-content-internal
[] []
(let [show-delivery-state? (reagent/atom false)] (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 (let [{:keys [content-type quoted-message content
outgoing outgoing-status pinned-by]} message-data outgoing outgoing-status pinned-by]} message-data
first-image (first (:album message-data)) first-image (first (:album message-data))
@ -163,7 +168,8 @@
[rn/view [rn/view
{:style {:padding-horizontal 4 {:style {:padding-horizontal 4
:flex-direction :row}} :flex-direction :row}}
[avatar-container message-data show-reactions? show-user-info?] [avatar-container message-data show-reactions? in-reaction-and-action-menu?
(:in-pinned-view? context)]
(into (into
(if show-reactions? (if show-reactions?
[rn/view] [rn/view]
@ -172,7 +178,7 @@
:flex 1 :flex 1
:max-height (when-not show-reactions? :max-height (when-not show-reactions?
(* 0.4 height))}} (* 0.4 height))}}
[author message-data show-reactions? show-user-info?] [author message-data show-reactions? in-reaction-and-action-menu?]
(condp = content-type (condp = content-type
constants/content-type-text constants/content-type-text
[content.text/text-content message-data context] [content.text/text-content message-data context]
@ -218,11 +224,11 @@
:selected-item (fn [] :selected-item (fn []
[rn/view {:pointer-events :none} [rn/view {:pointer-events :none}
[user-message-content [user-message-content
{:message-data message-data {:message-data message-data
:context context :context context
:keyboard-shown? keyboard-shown? :keyboard-shown? keyboard-shown?
:show-reactions? true :show-reactions? true
:show-user-info? true}]])}])) :in-reaction-and-action-menu? true}]])}]))
(defn system-message? (defn system-message?
[content-type] [content-type]

View File

@ -36,7 +36,7 @@
:background-color :transparent :background-color :transparent
:height 48 :height 48
:border-color :black :border-color :black
:border-width 3 :border-width 2
:border-radius 44})) :border-radius 44}))
(def picture-avatar-mask (def picture-avatar-mask