mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
UX: tweaks to msg actions menu (#18966)
- allows to scroll while hovering the menu - correctly changes message background color while hovering menu - prevents a bug where it would sometimes close the menu while moving from menu to the 3 dots expanded dropdown. This was caused by the gap between header/body of the 3 dots dropdown, which would sometimes allow to create a mouseover event on a possible different underlying message - removes recent/favorite reactions on drawer mode - grayscale reactions until hover - boxshadow on msgactions container - removes useless code
This commit is contained in:
parent
3b735d8fc5
commit
c0a4823203
@ -4,6 +4,7 @@ import { render } from "@ember/test-helpers";
|
|||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import { hbs } from "ember-cli-htmlbars";
|
import { hbs } from "ember-cli-htmlbars";
|
||||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||||
|
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||||
|
|
||||||
const DEFAULT_CONTENT = [
|
const DEFAULT_CONTENT = [
|
||||||
{ id: 1, name: "foo" },
|
{ id: 1, name: "foo" },
|
||||||
@ -391,4 +392,23 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("options.verticalOffset", async function (assert) {
|
||||||
|
setDefaultState(this, { verticalOffset: -50 });
|
||||||
|
await render(hbs`
|
||||||
|
<SingleSelect
|
||||||
|
@value={{this.value}}
|
||||||
|
@content={{this.content}}
|
||||||
|
@nameProperty={{this.nameProperty}}
|
||||||
|
@valueProperty={{this.valueProperty}}
|
||||||
|
@onChange={{this.onChange}}
|
||||||
|
@options={{hash verticalOffset=this.verticalOffset}}
|
||||||
|
/>
|
||||||
|
`);
|
||||||
|
await this.subject.expand();
|
||||||
|
const header = query(".select-kit-header").getBoundingClientRect();
|
||||||
|
const body = query(".select-kit-body").getBoundingClientRect();
|
||||||
|
|
||||||
|
assert.ok(header.bottom > body.top, "it correctly offsets the body");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -283,6 +283,7 @@ export default Component.extend(
|
|||||||
closeOnChange: true,
|
closeOnChange: true,
|
||||||
limitMatches: null,
|
limitMatches: null,
|
||||||
placement: isDocumentRTL() ? "bottom-end" : "bottom-start",
|
placement: isDocumentRTL() ? "bottom-end" : "bottom-start",
|
||||||
|
verticalOffset: 3,
|
||||||
filterComponent: "select-kit/select-kit-filter",
|
filterComponent: "select-kit/select-kit-filter",
|
||||||
selectedNameComponent: "selected-name",
|
selectedNameComponent: "selected-name",
|
||||||
selectedChoiceComponent: "selected-choice",
|
selectedChoiceComponent: "selected-choice",
|
||||||
@ -898,7 +899,7 @@ export default Component.extend(
|
|||||||
{
|
{
|
||||||
name: "offset",
|
name: "offset",
|
||||||
options: {
|
options: {
|
||||||
offset: [0, 3],
|
offset: [0, this.selectKit.options.verticalOffset],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -2,12 +2,16 @@ import Component from "@ember/component";
|
|||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
import { createPopper } from "@popperjs/core";
|
import { createPopper } from "@popperjs/core";
|
||||||
import { schedule } from "@ember/runloop";
|
import { schedule } from "@ember/runloop";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
const MSG_ACTIONS_PADDING = 2;
|
const MSG_ACTIONS_HORIZONTAL_PADDING = 2;
|
||||||
|
const MSG_ACTIONS_VERTICAL_PADDING = -15;
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
tagName: "",
|
tagName: "",
|
||||||
|
|
||||||
|
chatPreferredMode: service(),
|
||||||
|
|
||||||
messageActions: null,
|
messageActions: null,
|
||||||
|
|
||||||
didReceiveAttrs() {
|
didReceiveAttrs() {
|
||||||
@ -32,9 +36,9 @@ export default Component.extend({
|
|||||||
options: {
|
options: {
|
||||||
offset: ({ popper, placement }) => {
|
offset: ({ popper, placement }) => {
|
||||||
return [
|
return [
|
||||||
MSG_ACTIONS_PADDING,
|
MSG_ACTIONS_VERTICAL_PADDING,
|
||||||
-(placement.includes("left") || placement.includes("right")
|
-(placement.includes("left") || placement.includes("right")
|
||||||
? popper.width + MSG_ACTIONS_PADDING
|
? popper.width + MSG_ACTIONS_HORIZONTAL_PADDING
|
||||||
: popper.height),
|
: popper.height),
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
<ChatRetentionReminder @chatChannel={{this.chatChannel}} />
|
<ChatRetentionReminder @chatChannel={{this.chatChannel}} />
|
||||||
|
|
||||||
<div class="chat-message-actions-mobile-anchor"></div>
|
<div class="chat-message-actions-mobile-anchor"></div>
|
||||||
<div class="chat-message-actions-desktop-anchor"></div>
|
|
||||||
<div
|
<div
|
||||||
class={{concat-class
|
class={{concat-class
|
||||||
"chat-message-emoji-picker-anchor"
|
"chat-message-emoji-picker-anchor"
|
||||||
@ -44,6 +43,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="chat-messages-scroll chat-messages-container">
|
<div class="chat-messages-scroll chat-messages-container">
|
||||||
|
<div class="chat-message-actions-desktop-anchor"></div>
|
||||||
<div class="chat-messages-container">
|
<div class="chat-messages-container">
|
||||||
{{#if (or this.loading this.loadingMorePast)}}
|
{{#if (or this.loading this.loadingMorePast)}}
|
||||||
<ChatSkeleton @tagName="" />
|
<ChatSkeleton @tagName="" />
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
<div class="chat-msgactions-hover" data-id={{this.message.id}}>
|
<div class="chat-msgactions-hover" data-id={{this.message.id}}>
|
||||||
<div class="chat-msgactions">
|
<div class="chat-msgactions">
|
||||||
{{#each this.emojiReactions as |reaction|}}
|
{{#if this.chatPreferredMode.isFullPage}}
|
||||||
<ChatMessageReaction @reaction={{reaction}} @react={{this.messageActions.react}} @class="show" />
|
{{#each this.emojiReactions as |reaction|}}
|
||||||
{{/each}}
|
<ChatMessageReaction @reaction={{reaction}} @react={{this.messageActions.react}} @class="show" />
|
||||||
|
{{/each}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#if this.messageCapabilities.canReact}}
|
{{#if this.messageCapabilities.canReact}}
|
||||||
<DButton @class="btn-flat react-btn" @action={{this.messageActions.startReactionForMsgActions}} @icon="discourse-emojis" @title="chat.react" />
|
<DButton @class="btn-flat react-btn" @action={{this.messageActions.startReactionForMsgActions}} @icon="discourse-emojis" @title="chat.react" />
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
{{chat/track-message-visibility}}
|
{{chat/track-message-visibility}}
|
||||||
class={{concat-class
|
class={{concat-class
|
||||||
"chat-message-container"
|
"chat-message-container"
|
||||||
|
(if this.isHovered "is-hovered")
|
||||||
(if this.selectingMessages "selecting-messages")
|
(if this.selectingMessages "selecting-messages")
|
||||||
}}
|
}}
|
||||||
data-id={{or this.message.id this.message.stagedId}}
|
data-id={{or this.message.id this.message.stagedId}}
|
||||||
|
@ -14,6 +14,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chat-message-actions-desktop-anchor {
|
||||||
|
position: relative;
|
||||||
|
z-index: z("dropdown");
|
||||||
|
}
|
||||||
|
|
||||||
@mixin chat-reaction {
|
@mixin chat-reaction {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
@ -258,22 +263,14 @@
|
|||||||
|
|
||||||
.chat-msgactions-hover {
|
.chat-msgactions-hover {
|
||||||
@include unselectable;
|
@include unselectable;
|
||||||
position: absolute;
|
position: relative;
|
||||||
padding-right: 1rem;
|
|
||||||
padding-top: 0.25rem;
|
|
||||||
right: 0;
|
|
||||||
top: -1.5em;
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-message.is-reply .chat-msgactions-hover {
|
|
||||||
top: 0.5em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-msgactions {
|
.chat-msgactions {
|
||||||
border-radius: 0.25em;
|
border-radius: 0.25em;
|
||||||
background-color: var(--secondary);
|
background-color: var(--secondary);
|
||||||
display: flex;
|
display: flex;
|
||||||
|
box-shadow: 0 0.75px 0px rgba(0, 0, 0, 0.15);
|
||||||
|
|
||||||
.emoji-picker-anchor {
|
.emoji-picker-anchor {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -318,7 +315,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.d-icon {
|
.d-icon {
|
||||||
color: var(--primary-low-mid);
|
color: var(--primary-medium);
|
||||||
|
|
||||||
&.bookmark-icon__bookmarked {
|
&.bookmark-icon__bookmarked {
|
||||||
color: var(--tertiary);
|
color: var(--tertiary);
|
||||||
@ -326,12 +323,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.reply-btn {
|
|
||||||
.d-icon {
|
|
||||||
color: var(--tertiary);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.more-buttons.dropdown-select-box {
|
.more-buttons.dropdown-select-box {
|
||||||
.select-kit-header {
|
.select-kit-header {
|
||||||
background: none;
|
background: none;
|
||||||
@ -345,7 +336,6 @@
|
|||||||
&:focus {
|
&:focus {
|
||||||
border-color: var(--primary-low);
|
border-color: var(--primary-low);
|
||||||
border-left-color: transparent;
|
border-left-color: transparent;
|
||||||
background: var(--primary-low);
|
|
||||||
|
|
||||||
.select-kit-header-wrapper .d-icon {
|
.select-kit-header-wrapper .d-icon {
|
||||||
color: var(--primary);
|
color: var(--primary);
|
||||||
@ -356,7 +346,7 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
.d-icon {
|
.d-icon {
|
||||||
color: var(--primary-low-mid);
|
color: var(--primary-medium);
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -404,9 +394,10 @@
|
|||||||
margin-right: -1px;
|
margin-right: -1px;
|
||||||
padding: 0.5em 0;
|
padding: 0.5em 0;
|
||||||
width: 2.5em;
|
width: 2.5em;
|
||||||
|
filter: grayscale(100%);
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
z-index: 2;
|
filter: grayscale(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
@ -475,7 +466,7 @@
|
|||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-message-container:hover,
|
.chat-message-container.is-hovered,
|
||||||
.chat-message.chat-message-selected {
|
.chat-message.chat-message-selected {
|
||||||
background: var(--primary-very-low);
|
background: var(--primary-very-low);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user