Skip to content

Commit 4521929

Browse files
committed
fix: bottom padding in the case of a message with reactions
1 parent 711febe commit 4521929

File tree

7 files changed

+103
-97
lines changed

7 files changed

+103
-97
lines changed

src/status_im/common/bottom_sheet/view.cljs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
(ns status-im.common.bottom-sheet.view
22
(:require
3-
[oops.core :as oops]
4-
[quo.core :as quo]
5-
[quo.foundations.colors :as colors]
6-
[quo.theme :as quo.theme]
7-
[react-native.blur :as blur]
8-
[react-native.core :as rn]
9-
[react-native.gesture :as gesture]
10-
[react-native.hooks :as hooks]
11-
[react-native.reanimated :as reanimated]
12-
[status-im.common.bottom-sheet.style :as style]
13-
[utils.number]
14-
[utils.re-frame :as rf]))
3+
[oops.core :as oops]
4+
[quo.core :as quo]
5+
[quo.foundations.colors :as colors]
6+
[quo.theme :as quo.theme]
7+
[react-native.blur :as blur]
8+
[react-native.core :as rn]
9+
[react-native.gesture :as gesture]
10+
[react-native.hooks :as hooks]
11+
[react-native.reanimated :as reanimated]
12+
[status-im.common.bottom-sheet.style :as style]
13+
[utils.number]
14+
[utils.re-frame :as rf]))
1515

1616
(def duration 450)
1717
(def timing-options #js {:duration duration})

src/status_im/contexts/chat/messenger/menus/pinned_messages/style.cljs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(ns status-im.contexts.chat.messenger.menus.pinned-messages.style
22
(:require
3-
[react-native.platform :as platform]))
3+
[react-native.platform :as platform]))
44

55
(defn heading
66
[community?]
@@ -9,8 +9,8 @@
99

1010
(def community-tag-container
1111
{:margin-horizontal 20
12-
:margin-top 4
13-
:margin-bottom 8})
12+
:margin-top 4
13+
:margin-bottom 8})
1414

1515
(def no-pinned-messages-container
1616
{:justify-content :center

src/status_im/contexts/chat/messenger/menus/pinned_messages/view.cljs

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
(ns status-im.contexts.chat.messenger.menus.pinned-messages.view
22
(:require
3-
[quo.core :as quo]
4-
[quo.theme]
5-
[react-native.core :as rn]
6-
[react-native.gesture :as gesture]
7-
[status-im.common.resources :as resources]
8-
[status-im.contexts.chat.messenger.menus.pinned-messages.style :as style]
9-
[status-im.contexts.chat.messenger.messages.content.view :as message]
10-
[utils.i18n :as i18n]
11-
[utils.re-frame :as rf]))
3+
[quo.core :as quo]
4+
[quo.theme]
5+
[react-native.core :as rn]
6+
[react-native.gesture :as gesture]
7+
[status-im.common.resources :as resources]
8+
[status-im.contexts.chat.messenger.menus.pinned-messages.style :as style]
9+
[status-im.contexts.chat.messenger.messages.content.view :as message]
10+
[utils.i18n :as i18n]
11+
[utils.re-frame :as rf]))
1212

1313
(def list-key-fn #(or (:message-id %) (:value %)))
1414

@@ -59,14 +59,16 @@
5959
:channel-name (:chat-name current-chat)}])]
6060
(if (pos? (count pinned))
6161
[rn/flat-list
62-
{:data pinned
63-
:render-data (assoc render-data :disable-message-long-press? disable-message-long-press?)
64-
:render-fn message-render-fn
65-
:footer [rn/view {:style style/list-footer}]
62+
{:data pinned
63+
:render-data (assoc render-data
64+
:disable-message-long-press?
65+
disable-message-long-press?)
66+
:render-fn message-render-fn
67+
:footer [rn/view {:style style/list-footer}]
6668
:content-container-style {:padding-top 8
67-
:padding-bottom 8}
68-
:key-fn list-key-fn
69-
:separator [quo/separator {:style {:margin-vertical 8}}]}]
69+
:padding-bottom 0}
70+
:key-fn list-key-fn
71+
:separator [quo/separator {:style {:margin-vertical 8}}]}]
7072
[empty-pinned-messages-state
7173
{:theme theme}])]))
7274

src/status_im/contexts/chat/messenger/messages/content/reactions/view.cljs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
(:require
33
[quo.core :as quo]
44
[quo.theme :as quo.theme]
5+
[react-native.core :as rn]
56
[status-im.constants :as constants]
67
[status-im.contexts.chat.messenger.messages.drawers.view :as drawers]
78
[utils.re-frame :as rf]))
@@ -54,7 +55,7 @@
5455
(defn- view-internal
5556
[{:keys [message-id chat-id pinned-by preview? theme]} user-message-content]
5657
(let [reactions (rf/sub [:chats/message-reactions message-id chat-id])]
57-
[:<>
58+
[rn/view {:style {:padding-bottom 12}}
5859
(when (seq reactions)
5960
[quo/react
6061
{:container-style {:margin-left 44

src/status_im/contexts/chat/messenger/messages/content/style.cljs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(ns status-im.contexts.chat.messenger.messages.content.style
22
(:require
3-
[quo.foundations.colors :as colors]))
3+
[quo.foundations.colors :as colors]))
44

55
(def ^:private message-padding-scaling-ratio 4.5)
66

@@ -23,9 +23,9 @@
2323
:padding-bottom (if in-pinned-view?
2424
5
2525
(when (or small-screen?
26-
(and
27-
(> 3 window-scale)
28-
six-reactions?))
26+
(and
27+
(> 3 window-scale)
28+
six-reactions?))
2929
(* message-padding-scaling-ratio window-scale)))
3030
:opacity (if (and outgoing (= outgoing-status :sending))
3131
0.5

src/status_im/contexts/chat/messenger/messages/content/view.cljs

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
(ns status-im.contexts.chat.messenger.messages.content.view
22
(:require
3-
[clojure.string :as string]
4-
[legacy.status-im.ui.screens.chat.message.legacy-view :as old-message]
5-
[quo.core :as quo]
6-
[quo.foundations.colors :as colors]
7-
[quo.theme :as quo.theme]
8-
[react-native.core :as rn]
9-
[react-native.fast-image :as fast-image]
10-
[react-native.gesture :as gesture]
11-
[react-native.platform :as platform]
12-
[reagent.core :as reagent]
13-
[status-im.common.not-implemented :as not-implemented]
14-
[status-im.constants :as constants]
15-
[status-im.contexts.chat.messenger.composer.reply.view :as reply]
16-
[status-im.contexts.chat.messenger.messages.avatar.view :as avatar]
17-
[status-im.contexts.chat.messenger.messages.content.album.view :as album]
18-
[status-im.contexts.chat.messenger.messages.content.audio.view :as audio]
19-
[status-im.contexts.chat.messenger.messages.content.deleted.view :as content.deleted]
20-
[status-im.contexts.chat.messenger.messages.content.emoji-message.view :as emoji-message]
21-
[status-im.contexts.chat.messenger.messages.content.image.view :as image]
22-
[status-im.contexts.chat.messenger.messages.content.pin.view :as pin]
23-
[status-im.contexts.chat.messenger.messages.content.reactions.view :as reactions]
24-
[status-im.contexts.chat.messenger.messages.content.status.view :as status]
25-
[status-im.contexts.chat.messenger.messages.content.sticker-message.view :as sticker-message]
26-
[status-im.contexts.chat.messenger.messages.content.style :as style]
27-
[status-im.contexts.chat.messenger.messages.content.system.text.view :as system.text]
28-
[status-im.contexts.chat.messenger.messages.content.text.view :as content.text]
29-
[status-im.contexts.chat.messenger.messages.content.unknown.view :as content.unknown]
30-
[status-im.contexts.chat.messenger.messages.drawers.view :as drawers]
31-
[utils.address :as address]
32-
[utils.datetime :as datetime]
33-
[utils.re-frame :as rf]))
3+
[clojure.string :as string]
4+
[legacy.status-im.ui.screens.chat.message.legacy-view :as old-message]
5+
[quo.core :as quo]
6+
[quo.foundations.colors :as colors]
7+
[quo.theme :as quo.theme]
8+
[react-native.core :as rn]
9+
[react-native.fast-image :as fast-image]
10+
[react-native.gesture :as gesture]
11+
[react-native.platform :as platform]
12+
[reagent.core :as reagent]
13+
[status-im.common.not-implemented :as not-implemented]
14+
[status-im.constants :as constants]
15+
[status-im.contexts.chat.messenger.composer.reply.view :as reply]
16+
[status-im.contexts.chat.messenger.messages.avatar.view :as avatar]
17+
[status-im.contexts.chat.messenger.messages.content.album.view :as album]
18+
[status-im.contexts.chat.messenger.messages.content.audio.view :as audio]
19+
[status-im.contexts.chat.messenger.messages.content.deleted.view :as content.deleted]
20+
[status-im.contexts.chat.messenger.messages.content.emoji-message.view :as emoji-message]
21+
[status-im.contexts.chat.messenger.messages.content.image.view :as image]
22+
[status-im.contexts.chat.messenger.messages.content.pin.view :as pin]
23+
[status-im.contexts.chat.messenger.messages.content.reactions.view :as reactions]
24+
[status-im.contexts.chat.messenger.messages.content.status.view :as status]
25+
[status-im.contexts.chat.messenger.messages.content.sticker-message.view :as sticker-message]
26+
[status-im.contexts.chat.messenger.messages.content.style :as style]
27+
[status-im.contexts.chat.messenger.messages.content.system.text.view :as system.text]
28+
[status-im.contexts.chat.messenger.messages.content.text.view :as content.text]
29+
[status-im.contexts.chat.messenger.messages.content.unknown.view :as content.unknown]
30+
[status-im.contexts.chat.messenger.messages.drawers.view :as drawers]
31+
[utils.address :as address]
32+
[utils.datetime :as datetime]
33+
[utils.re-frame :as rf]))
3434

3535
(def delivery-state-showing-time-ms 3000)
3636

@@ -184,6 +184,7 @@
184184
six-reactions? (-> reactions
185185
count
186186
(= 6))]
187+
(js/console.log (str "ewvewbewb " reactions "message id " message-id))
187188
[rn/touchable-highlight
188189
{:accessibility-label (if (and outgoing (= outgoing-status :sending))
189190
:message-sending
@@ -260,7 +261,7 @@
260261

261262
(when @show-delivery-state?
262263
[status/status outgoing-status])])]
263-
(when show-reactions?
264+
(when (and show-reactions? (seq reactions))
264265
[reactions/message-reactions-row (assoc message-data :preview? preview?)
265266
[rn/view {:pointer-events :none}
266267
[user-message-content-internal

src/status_im/contexts/chat/messenger/messages/pin/events.cljs

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
(ns status-im.contexts.chat.messenger.messages.pin.events
22
(:require
3-
[legacy.status-im.data-store.messages :as data-store.messages]
4-
[legacy.status-im.data-store.pin-messages :as data-store.pin-messages]
5-
[re-frame.core :as re-frame]
6-
[status-im.common.toasts.events :as toasts]
7-
[status-im.constants :as constants]
8-
[status-im.contexts.chat.messenger.menus.pinned-messages.view :as pinned-messages-menu]
9-
[status-im.contexts.chat.messenger.messages.list.events :as message-list]
10-
[status-im.navigation.events :as navigation]
11-
[taoensso.timbre :as log]
12-
[utils.i18n :as i18n]
13-
[utils.re-frame :as rf]))
3+
[legacy.status-im.data-store.messages :as data-store.messages]
4+
[legacy.status-im.data-store.pin-messages :as data-store.pin-messages]
5+
[re-frame.core :as re-frame]
6+
[status-im.common.toasts.events :as toasts]
7+
[status-im.constants :as constants]
8+
[status-im.contexts.chat.messenger.menus.pinned-messages.view :as pinned-messages-menu]
9+
[status-im.contexts.chat.messenger.messages.list.events :as message-list]
10+
[status-im.navigation.events :as navigation]
11+
[taoensso.timbre :as log]
12+
[utils.i18n :as i18n]
13+
[utils.re-frame :as rf]))
1414

1515
(rf/defn handle-failed-loading-pin-messages
1616
{:events [:pin-message/failed-loading-pin-messages]}
@@ -46,14 +46,14 @@
4646
(if (and message
4747
(aget message "message"))
4848
(assoc-in db
49-
[:pin-messages
50-
(aget pinned-message "localChatId")
51-
(aget pinned-message "message_id")]
52-
(-> (aget message "message")
53-
(js->clj :keywordize-keys true)
54-
data-store.messages/<-rpc
55-
(assoc :pinned-by (aget message "pinnedBy")
56-
:pinned-at (aget message "pinnedAt"))))
49+
[:pin-messages
50+
(aget pinned-message "localChatId")
51+
(aget pinned-message "message_id")]
52+
(-> (aget message "message")
53+
(js->clj :keywordize-keys true)
54+
data-store.messages/<-rpc
55+
(assoc :pinned-by (aget message "pinnedBy")
56+
:pinned-at (aget message "pinnedAt"))))
5757
db)))
5858

5959
(rf/defn receive-signal
@@ -73,8 +73,8 @@
7373
pin-messages)]
7474
{:db
7575
(assoc-in db
76-
[:pin-message-lists current-chat-id]
77-
(message-list/add-many nil (vals (get-in db [:pin-messages current-chat-id]))))}))
76+
[:pin-message-lists current-chat-id]
77+
(message-list/add-many nil (vals (get-in db [:pin-messages current-chat-id]))))}))
7878

7979
(rf/defn send-pin-message-locally
8080
"Pin message, rebuild pinned messages list locally"
@@ -87,12 +87,12 @@
8787
{:db (cond-> db
8888
pinned
8989
(->
90-
(update-in [:pin-message-lists chat-id] message-list/add message)
91-
(assoc-in [:pin-messages chat-id message-id] message))
90+
(update-in [:pin-message-lists chat-id] message-list/add message)
91+
(assoc-in [:pin-messages chat-id message-id] message))
9292
(and (not pinned) pin-message-lists-exist?)
9393
(->
94-
(update-in [:pin-message-lists chat-id] message-list/remove-message pin-message)
95-
(update-in [:pin-messages chat-id] dissoc message-id)))})))
94+
(update-in [:pin-message-lists chat-id] message-list/remove-message pin-message)
95+
(update-in [:pin-messages chat-id] dissoc message-id)))})))
9696

9797
(rf/defn send-pin-message
9898
"Pin message, rebuild pinned messages list"
@@ -130,7 +130,9 @@
130130
[cofx chat-id]
131131
(navigation/show-bottom-sheet
132132
cofx
133-
{:padding-bottom-override 21
134-
:content (fn [] [pinned-messages-menu/view
135-
{:chat-id chat-id
136-
:disable-message-long-press? (not= :chat (get-in cofx [:db :view-id]))}])}))
133+
{:padding-bottom-override 21
134+
:content (fn [] [pinned-messages-menu/view
135+
{:chat-id chat-id
136+
:disable-message-long-press? (not= :chat
137+
(get-in cofx
138+
[:db :view-id]))}])}))

0 commit comments

Comments
 (0)