diff --git a/src/status_im/ui/screens/chat/sheets.cljs b/src/status_im/ui/screens/chat/sheets.cljs index c4b394cc8d..408a5cb6d5 100644 --- a/src/status_im/ui/screens/chat/sheets.cljs +++ b/src/status_im/ui/screens/chat/sheets.cljs @@ -16,6 +16,7 @@ (re-frame/dispatch event)) (defn one-to-one-chat-accents [chat-id] + (let [photo @(re-frame/subscribe [:chats/photo-path chat-id]) contact-name @(re-frame/subscribe [:contacts/contact-name-by-identity chat-id])] [react/view diff --git a/src/status_im/ui2/screens/chat/components/chat_bottom_sheet/test.cljs b/src/status_im/ui2/screens/chat/components/chat_bottom_sheet/test.cljs new file mode 100644 index 0000000000..63e74cb8fc --- /dev/null +++ b/src/status_im/ui2/screens/chat/components/chat_bottom_sheet/test.cljs @@ -0,0 +1 @@ +(ns status-im.ui2.screens.chat.components.chat-bottom-sheet.test) diff --git a/src/status_im/ui2/screens/chat/components/chat_bottom_sheet/view.cljs b/src/status_im/ui2/screens/chat/components/chat_bottom_sheet/view.cljs index cc7c427aa2..59bc286b63 100644 --- a/src/status_im/ui2/screens/chat/components/chat_bottom_sheet/view.cljs +++ b/src/status_im/ui2/screens/chat/components/chat_bottom_sheet/view.cljs @@ -1,64 +1,81 @@ (ns status-im.ui2.screens.chat.components.chat-bottom-sheet.view - (:require [re-frame.core :as re-frame] - [status-im.i18n.i18n :as i18n] - [status-im.ui.components.react :as react] - [status-im.constants :as constants] - [status-im.ui.components.list-selection :as list-selection] - [status-im.utils.universal-links.utils :as universal-links] - [status-im.ui.components.chat-icon.screen :as chat-icon] - [status-im.multiaccounts.core :as multiaccounts] - [status-im.ui.screens.chat.styles.message.sheets :as sheets.styles] - [quo.core :as quo] - [status-im.chat.models.pin-message :as models.pin-message] + (:require [status-im.i18n.i18n :as i18n] [quo.react-native :as rn] - [quo2.components.icon :as icons] - [quo2.foundations.colors :as colors] - [quo2.components.markdown.text :as text] + [status-im.ui2.screens.chat.messages.message :refer [pinned-messages-list]] [quo2.components.drawers.action-drawers :refer [divider]] - [quo2.components.list-items.menu-item :as quo2.menu-item])) + [quo2.components.list-items.menu-item :as quo2.menu-item] + [re-frame.core :as rf])) -(defn chat-bottom-sheet [] +(defn hide-sheet-and-dispatch [event] + (rf/dispatch [:bottom-sheet/hide]) + (rf/dispatch event)) + +(defn chat-bottom-sheet [{:keys [chat-id group-chat]}] [rn/view - [quo2.menu-item/menu-item - {:type :main - :title (i18n/label :t/view-profile) - :accessibility-label "view-profile" - :icon :friend - :on-press #(println "PPP")}] + (if group-chat + [quo2.menu-item/menu-item + {:type :main + :title (i18n/label :t/group-details) + :accessibility-label "group-details" + :icon :members + :on-press #(hide-sheet-and-dispatch [:show-group-chat-profile chat-id])}] + [quo2.menu-item/menu-item + {:type :main + :title (i18n/label :t/view-profile) + :accessibility-label "view-profile" + :icon :friend + :on-press #(hide-sheet-and-dispatch [:chat.ui/show-profile chat-id])}]) + [divider] [quo2.menu-item/menu-item {:type :main :title (i18n/label :t/mark-as-read) :accessibility-label "mark-as-read" :icon :correct - :on-press #(println "PPP")}] + :on-press #(hide-sheet-and-dispatch [:chat.ui/mark-all-read-pressed chat-id])}] [quo2.menu-item/menu-item {:type :main :title (i18n/label :t/mute-chat) :description "Muted for 15 minutes" :accessibility-label "mute-chat" :icon :muted - :arrow? true - :on-press #(println "PPP")}] + :arrow? true + :on-press #(println "TODO: mute chat")}] ; TODO: issue https://github.com/status-im/status-mobile/issues/14269 [quo2.menu-item/menu-item {:type :main :title (i18n/label :t/notifications) :description "Only @mentions" :accessibility-label "notifications" :icon :notifications - :arrow? true - :on-press #(println "PPP")}] + :arrow? true + :on-press #(println "TODO: chat notifications")}] + (when group-chat + [quo2.menu-item/menu-item + {:type :main + :title (i18n/label :t/pinned-messages) + :accessibility-label "pinned-messages" + :icon :pin + :on-press (fn [] + (rf/dispatch [:bottom-sheet/hide]) + (rf/dispatch [:bottom-sheet/show-sheet + {:content #(pinned-messages-list chat-id)}]))}]) [divider] [quo2.menu-item/menu-item {:type :danger :title (i18n/label :t/clear-history) :accessibility-label "clear-history" :icon :delete - :on-press #(println "PPP")}] - [quo2.menu-item/menu-item - {:type :danger - :title (i18n/label :t/delete-chat) - :accessibility-label "delete-chat" - :icon :delete - :on-press #(println "PPP")}] - ]) + :on-press #(rf/dispatch [:chat.ui/clear-history-pressed chat-id])}] + (if group-chat + [quo2.menu-item/menu-item + {:type :danger + :title (i18n/label :t/leave-and-delete-group) + :accessibility-label "leave-group" + :icon :log-out + :on-press #(rf/dispatch [:group-chats.ui/leave-chat-pressed chat-id])}] + [quo2.menu-item/menu-item + {:type :danger + :title (i18n/label :t/delete-chat) + :accessibility-label "delete-chat" + :icon :delete + :on-press #(rf/dispatch [:chat.ui/remove-chat-pressed chat-id])}])]) diff --git a/src/status_im/ui2/screens/chat/components/message_home_item/view.cljs b/src/status_im/ui2/screens/chat/components/message_home_item/view.cljs index a7ae3de4a1..482ad8764a 100644 --- a/src/status_im/ui2/screens/chat/components/message_home_item/view.cljs +++ b/src/status_im/ui2/screens/chat/components/message_home_item/view.cljs @@ -206,7 +206,7 @@ (>evt [:search/home-filter-changed nil]) (>evt [:accept-all-activity-center-notifications-from-chat chat-id])) :on-long-press #(>evt [:bottom-sheet/show-sheet - {:content (fn [] [chat-bottom-sheet item])}])}) + {:content (fn [] [chat-bottom-sheet item group-chat])}])}) (if group-chat [rn/view {:style (style/group-chat-icon color)} [icons/icon :main-icons2/group {:size 16 :color colors/white-opa-70}]] diff --git a/translations/en.json b/translations/en.json index 7f4062d721..cd655e913a 100644 --- a/translations/en.json +++ b/translations/en.json @@ -1850,6 +1850,7 @@ "pending-requests": "Pending requests", "received": "Received", "sent": "Sent", +<<<<<<< HEAD <<<<<<< HEAD "and": "and" ======= @@ -1887,4 +1888,9 @@ "sent": "Sent", "and": "and" >>>>>>> 5fcc08fd3... refactor +======= + "and": "and", + "group-details": "Group details", + "leave-and-delete-group": "Leave and delete group" +>>>>>>> 1c10d3dda... feat: chat bottom sheet }