Skip to content

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

FIX: Minor chat context menu fixes (#36969)

Martin Brennanb180944767b7
diff --git a/app/assets/stylesheets/common/base/sidebar-section-link.scss b/app/assets/stylesheets/common/base/sidebar-section-link.scss
index bb5725df63c..7e02018e1bf 100644
--- a/app/assets/stylesheets/common/base/sidebar-section-link.scss
+++ b/app/assets/stylesheets/common/base/sidebar-section-link.scss
@@ -279,7 +279,7 @@
color: var(--d-sidebar-highlight-color);
border: none;
background: transparent;
- padding: 0 0.5em;
+ padding: 0 0 0 var(--space-2);
height: 100%;
&:focus,
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel-sidebar-context-menu.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-channel-sidebar-context-menu.gjs
index 5ca992600ad..bea9cad4302 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-channel-sidebar-context-menu.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel-sidebar-context-menu.gjs
@@ -157,7 +157,7 @@ export default class ChatChannelSidebarContextMenu extends Component {
@icon="xmark"
@label="chat.channel_settings.leave_channel"
@title="chat.channel_settings.leave_channel"
- class="chat-channel-sidebar-link-menu__leave-channel btn-danger"
+ class="chat-channel-sidebar-link-menu__leave-channel --danger"
/>
</dropdown.item>
</DropdownMenu>
diff --git a/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js b/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js
index b80ac447205..1d071233c6f 100644
--- a/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js
+++ b/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js
@@ -4,11 +4,12 @@ import { service } from "@ember/service";
import { dasherize } from "@ember/string";
import { htmlSafe } from "@ember/template";
import { decorateUsername } from "discourse/helpers/decorate-username-selector";
+import noop from "discourse/helpers/noop";
import { avatarUrl } from "discourse/lib/avatar-utils";
import { bind } from "discourse/lib/decorators";
import { withPluginApi } from "discourse/lib/plugin-api";
import { emojiUnescape } from "discourse/lib/text";
-import { escapeExpression } from "discourse/lib/utilities";
+import { escapeExpression, isiPad } from "discourse/lib/utilities";
import { i18n } from "discourse-i18n";
import ChatModalNewMessage from "discourse/plugins/chat/discourse/components/chat/modal/new-message";
import ChatChannelSidebarContextMenu from "discourse/plugins/chat/discourse/components/chat-channel-sidebar-context-menu";
@@ -21,7 +22,7 @@ import {
const CHAT_STARRED_CHANNELS_SECTION = "chat-starred-channels";
function createChannelLink(BaseCustomSidebarSectionLink, options = {}) {
- const { showSuffix = true, enableHoverForPublicChannels = false } = options;
+ const { showSuffix = true } = options;
return class extends BaseCustomSidebarSectionLink {
route = "chat.channel";
@@ -225,28 +226,6 @@ function createChannelLink(BaseCustomSidebarSectionLink, options = {}) {
get suffixCSSClass() {
return showSuffix ? "" : "";
}
-
- get hoverValue() {
- if (this.isDM) {
- return "xmark";
- }
- return enableHoverForPublicChannels ? "" : "";
- }
-
- get hoverTitle() {
- return this.isDM ? i18n("chat.direct_messages.close") : "";
- }
-
- get hoverAction() {
- if (this.isDM) {
- return (event) => {
- event.stopPropagation();
- event.preventDefault();
- this.chatService.unfollowChannel(this.channel);
- };
- }
- return null;
- }
};
}
@@ -391,7 +370,6 @@ export default {
BaseCustomSidebarSectionLink,
{
showSuffix: false,
- enableHoverForPublicChannels: false,
}
);
@@ -402,7 +380,11 @@ export default {
}
get hoverValue() {
- return "ellipsis";
+ if (isiPad()) {
+ return;
+ }
+
+ return "ellipsis-vertical";
}
get hoverTitle() {
@@ -410,6 +392,10 @@ export default {
}
get hoverAction() {
+ if (isiPad()) {
+ return noop;
+ }
+
return (event, onMenuClose) => {
event.stopPropagation();
event.preventDefault();
@@ -493,7 +479,7 @@ export default {
(BaseCustomSidebarSection, BaseCustomSidebarSectionLink) => {
const SidebarChatChannelsSectionLink = class extends BaseCustomSidebarSectionLink {
hoverType = "icon";
- hoverValue = "ellipsis";
+ hoverValue = isiPad() ? null : "ellipsis-vertical";
hoverTitle = i18n("chat.open_channel_menu");
constructor({ channel, chatService, siteSettings, menuService }) {
@@ -584,6 +570,10 @@ export default {
}
get hoverAction() {
+ if (isiPad()) {
+ return noop;
+ }
+
return (event, onMenuClose) => {
event.stopPropagation();
event.preventDefault();
@@ -697,7 +687,7 @@ export default {
route = "chat.channel";
suffixType = "icon";
hoverType = "icon";
- hoverValue = "ellipsis";
+ hoverValue = isiPad() ? null : "ellipsis-vertical";
hoverTitle = i18n("chat.open_channel_menu");
constructor({
@@ -848,6 +838,10 @@ export default {
}
get hoverAction() {
+ if (isiPad()) {
+ return noop;
+ }
+
return (event, onMenuClose) => {
event.stopPropagation();
event.preventDefault();
diff --git a/plugins/chat/assets/stylesheets/desktop/chat-channel-sidebar-menu.scss b/plugins/chat/assets/stylesheets/desktop/chat-channel-sidebar-menu.scss
deleted file mode 100644
index 46b95729945..00000000000
--- a/plugins/chat/assets/stylesheets/desktop/chat-channel-sidebar-menu.scss
+++ /dev/null
@@ -1,11 +0,0 @@
-.fk-d-menu[data-identifier="chat-channel-menu"],
-.fk-d-menu[data-identifier="chat-channel-menu-notification-submenu"],
-.fk-d-menu[data-identifier="chat-direct-message-channel-menu"] {
- .dropdown-menu__item {
- &:hover {
- button {
- background: var(--d-sidebar-highlight-background);
- }
- }
- }
-}
diff --git a/plugins/chat/assets/stylesheets/desktop/index.scss b/plugins/chat/assets/stylesheets/desktop/index.scss
index c45290e21fc..7ae411ba1b0 100644
--- a/plugins/chat/assets/stylesheets/desktop/index.scss
+++ b/plugins/chat/assets/stylesheets/desktop/index.scss
@@ -3,7 +3,6 @@
@import "chat-index-drawer";
@import "chat-index-full-page";
@import "chat-channel";
-@import "chat-channel-sidebar-menu";
@import "chat-message-actions";
@import "chat-message";
@import "chat-channel-info";