Skip to content

A platform for community discussion. Free, open, simple.

UX: Adjust message actions position and add padding for mouse movement (#38299)

Jarek Radoszc7087914aa5e
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-message-actions-desktop.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-message-actions-desktop.gjs
index aea9e9d0eb1..eea866cc558 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-message-actions-desktop.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-message-actions-desktop.gjs
@@ -25,7 +25,8 @@ import ChatMessageReaction from "discourse/plugins/chat/discourse/components/cha
import chatMessageContainer from "discourse/plugins/chat/discourse/lib/chat-message-container";
import ChatMessageInteractor from "discourse/plugins/chat/discourse/lib/chat-message-interactor";
-const MSG_ACTIONS_VERTICAL_PADDING = -10;
+const MSG_ACTIONS_USER_INFO_VERTICAL_OFFSET = -24;
+const MSG_ACTIONS_VERTICAL_OFFSET = -6;
const FULL = "full";
const REDUCED = "reduced";
const REDUCED_WIDTH_THRESHOLD = 500;
@@ -75,7 +76,7 @@ export default class ChatMessageActionsDesktop extends Component {
return;
}
- const boundary = this.messageContainer.closest(".chat-messages-scroller");
+ const boundary = container.closest(".chat-messages-scroller");
if (!boundary) {
return;
@@ -89,7 +90,9 @@ export default class ChatMessageActionsDesktop extends Component {
strategy: "fixed",
middleware: [
offset({
- mainAxis: MSG_ACTIONS_VERTICAL_PADDING,
+ mainAxis: this.chat.activeMessage?.hideUserInfo
+ ? MSG_ACTIONS_VERTICAL_OFFSET
+ : MSG_ACTIONS_USER_INFO_VERTICAL_OFFSET,
crossAxis: -2,
}),
flip({
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-message.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-message.gjs
index 6a7b983700d..c30ee6fbee5 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-message.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-message.gjs
@@ -359,6 +359,7 @@ export default class ChatMessage extends Component {
this.chat.activeMessage = {
model: this.args.message,
+ hideUserInfo: this.hideUserInfo,
context: this.args.context,
};
}
diff --git a/plugins/chat/assets/stylesheets/common/chat-message-actions.scss b/plugins/chat/assets/stylesheets/common/chat-message-actions.scss
index 72ec24b2fca..f0b85e12a1d 100644
--- a/plugins/chat/assets/stylesheets/common/chat-message-actions.scss
+++ b/plugins/chat/assets/stylesheets/common/chat-message-actions.scss
@@ -9,6 +9,7 @@
width: max-content;
top: 0;
left: 0;
+ padding-left: 72px !important; /* for easier mouse movement to the element */
z-index: z("composer", "content");
// dynamically overridden by the component