UX: chat mobile tweaks (#21041)

- rounded active style for messages
- better active state on chat message actions rows
- ensures long press on a message is not selecting text
- slightly improved messages actions animation and background fading
- ensures chat emoji picker is not cutoff on right side
- removes old legacy code related to hovered message
This commit is contained in:
Joffrey JAFFEUX 2023-04-11 09:03:12 +02:00 committed by GitHub
parent e34fb7e0b2
commit f55266e1ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 42 additions and 32 deletions

View File

@ -123,7 +123,7 @@ export default class ChatMessage extends Component {
return; return;
} }
if (this.pane.hoveredMessageId === this.args.message.id) { if (this.chat.activeMessage?.model?.id === this.args.message.id) {
return; return;
} }
@ -166,11 +166,12 @@ export default class ChatMessage extends Component {
model: this.args.message, model: this.args.message,
context: this.args.context, context: this.args.context,
}; };
this.pane.hoveredMessageId = this.args.message.id;
} }
@action @action
handleTouchStart() { handleTouchStart(event) {
event.stopPropagation();
// if zoomed don't track long press // if zoomed don't track long press
if (isZoomed()) { if (isZoomed()) {
return; return;
@ -188,12 +189,16 @@ export default class ChatMessage extends Component {
} }
@action @action
handleTouchMove() { handleTouchMove(event) {
event.stopPropagation();
cancel(this._isPressingHandler); cancel(this._isPressingHandler);
} }
@action @action
handleTouchEnd() { handleTouchEnd(event) {
event.stopPropagation();
cancel(this._isPressingHandler); cancel(this._isPressingHandler);
} }

View File

@ -12,7 +12,6 @@ export default class ChatChannelPane extends Service {
@tracked reacting = false; @tracked reacting = false;
@tracked selectingMessages = false; @tracked selectingMessages = false;
@tracked hoveredMessageId = false;
@tracked lastSelectedMessage = null; @tracked lastSelectedMessage = null;
@tracked sendingLoading = false; @tracked sendingLoading = false;

View File

@ -9,7 +9,6 @@ import { and } from "@ember/object/computed";
import { computed } from "@ember/object"; import { computed } from "@ember/object";
import discourseLater from "discourse-common/lib/later"; import discourseLater from "discourse-common/lib/later";
import ChatMessageDraft from "discourse/plugins/chat/discourse/models/chat-message-draft"; import ChatMessageDraft from "discourse/plugins/chat/discourse/models/chat-message-draft";
import { MESSAGE_CONTEXT_THREAD } from "discourse/plugins/chat/discourse/components/chat-message";
const CHAT_ONLINE_OPTIONS = { const CHAT_ONLINE_OPTIONS = {
userUnseenTime: 300000, // 5 minutes seconds with no interaction userUnseenTime: 300000, // 5 minutes seconds with no interaction
@ -78,17 +77,8 @@ export default class Chat extends Service {
} }
set activeMessage(hash) { set activeMessage(hash) {
this.chatChannelPane.hoveredMessageId = null;
this.chatChannelThreadPane.hoveredMessageId = null;
if (hash) { if (hash) {
this._activeMessage = hash; this._activeMessage = hash;
if (hash.context === MESSAGE_CONTEXT_THREAD) {
this.chatChannelThreadPane.hoveredMessageId = hash.model.id;
} else {
this.chatChannelPane.hoveredMessageId = hash.model.id;
}
} else { } else {
this._activeMessage = null; this._activeMessage = null;
} }

View File

@ -95,7 +95,7 @@
} }
& + .chat-message-separator__line-container { & + .chat-message-separator__line-container {
padding: 20px 0 20px 1em; padding: 20px 0;
box-sizing: border-box; box-sizing: border-box;
.chat-message-separator__line { .chat-message-separator__line {

View File

@ -197,6 +197,7 @@
.touch & { .touch & {
&:active { &:active {
background: var(--primary-very-low); background: var(--primary-very-low);
border-radius: 5px;
} }
&.chat-message-bookmarked { &.chat-message-bookmarked {

View File

@ -11,6 +11,7 @@
box-shadow: shadow("card"); box-shadow: shadow("card");
z-index: z("header") + 2; z-index: z("header") + 2;
max-width: 100vw; max-width: 100vw;
box-sizing: border-box;
&__backdrop { &__backdrop {
position: fixed; position: fixed;

View File

@ -6,8 +6,11 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
border-radius: 8px 8px 0 0; border-radius: 8px 8px 0 0;
margin: 0 2px; margin: 0 5px;
transition: bottom 0.2s ease; transition: bottom 0.2s cubic-bezier(0.4, 0, 0.2, 1),
visibility cubic-bezier(0.4, 0, 0.2, 1);
visibility: hidden;
box-sizing: border-box;
.selected-message-container { .selected-message-container {
padding: 0.5em 0.5em 1em 0.5em; padding: 0.5em 0.5em 1em 0.5em;
@ -82,6 +85,10 @@
.bookmark-btn { .bookmark-btn {
flex-grow: 1; flex-grow: 1;
height: 42px; height: 42px;
&:active {
background: var(--primary-low);
}
} }
.bookmark-btn, .bookmark-btn,
@ -112,14 +119,15 @@
border-bottom: 1px solid var(--primary-low); border-bottom: 1px solid var(--primary-low);
width: 100%; width: 100%;
list-style: none; list-style: none;
padding-bottom: 0.25em; padding: 0.25em 0;
margin-bottom: 0.25em;
display: flex; display: flex;
&:active {
background: var(--primary-low);
}
&:last-child { &:last-child {
border: 0; border-bottom: 0;
margin: 0;
padding: 0;
} }
.chat-message-action { .chat-message-action {
@ -146,7 +154,7 @@
height: 100%; height: 100%;
width: 100%; width: 100%;
z-index: z("header") + 1; z-index: z("header") + 1;
transition: background-color 0.2s ease; transition: background-color 0.4s ease;
.collapse-area { .collapse-area {
width: 100%; width: 100%;
@ -154,10 +162,11 @@
} }
&.fade-in { &.fade-in {
background-color: rgba(0, 0, 0, 0.35); background: rgba(var(--always-black-rgb), 0.75);
.chat-message-actions { .chat-message-actions {
bottom: 0; bottom: 0px;
visibility: visible;
} }
} }
} }

View File

@ -1,6 +1,11 @@
.chat-message *, .mobile-view.has-full-page-chat {
.chat-composer-row, #skip-link,
.chat-reply, .d-header,
.replying-text { .chat-message-actions-mobile-outlet,
@include unselectable; .chat-live-pane,
.chat-thread {
> * {
@include user-select(none);
}
}
} }