A platform for community discussion. Free, open, simple.
UX: chat message thread indicator improvements (#22224)
chapoi802fb3b19456
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-message-thread-indicator.hbs b/plugins/chat/assets/javascripts/discourse/components/chat-message-thread-indicator.hbsindex ed467c7dc9f..12f5cbbabbc 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-message-thread-indicator.hbs+++ b/plugins/chat/assets/javascripts/discourse/components/chat-message-thread-indicator.hbs@@ -8,50 +8,24 @@role="button"title={{i18n "chat.threads.open"}}>- {{#unless this.chatStateManager.isDrawerActive}}- <div class="chat-message-thread-indicator__last-reply-avatar">- <ChatUserAvatar- @user={{@message.thread.preview.lastReplyUser}}- @avatarSize="small"- />- </div>- {{/unless}}- <div class="chat-message-thread-indicator__body">- <div class="chat-message-thread-indicator__last-reply-metadata">- <div class="chat-message-thread-indicator__last-reply-user">- {{#if (or this.site.mobileView this.chatStateManager.isDrawerActive)}}- <span- class="chat-message-thread-indicator__last-reply-avatar -mobile"- >- <ChatUserAvatar- @user={{@message.thread.preview.lastReplyUser}}- @avatarSize="tiny"- />- </span>- {{/if}}- <span class="chat-message-thread-indicator__last-reply-username">- {{@message.thread.preview.lastReplyUser.username}}- </span>- </div>- <span class="chat-message-thread-indicator__last-reply-container">- {{format-date- @message.thread.preview.lastReplyCreatedAt- leaveAgo="true"- prefix=(i18n "chat.thread.last_reply")- }}- </span>- <span class="separator">|</span>- <span class="chat-message-thread-indicator__replies-count">- {{i18n "chat.thread.replies" [email protected]}}- </span>- </div>- <div class="chat-message-thread-indicator__last-reply-excerpt">- {{replace-emoji (html-safe @message.thread.preview.lastReplyExcerpt)}}- </div>+ <div class="chat-message-thread-indicator__last-reply-avatar">+ <ChatUserAvatar+ @user={{@message.thread.preview.lastReplyUser}}+ @avatarSize="small"+ /></div>- <div class="chat-message-thread-indicator__participants">- <Chat::Thread::Participants @thread={{@message.thread}} />+ <div class="chat-message-thread-indicator__last-reply-info">+ <span class="chat-message-thread-indicator__last-reply-username">+ {{@message.thread.preview.lastReplyUser.username}}+ </span>+ <span class="chat-message-thread-indicator__last-reply-timestamp">+ {{format-date @message.thread.preview.lastReplyCreatedAt leaveAgo="true"}}+ </span>+ </div>+ <Chat::Thread::Participants @thread={{@message.thread}} />+ <div class="chat-message-thread-indicator__last-reply-excerpt">+ {{replace-emoji (html-safe @message.thread.preview.lastReplyExcerpt)}}</div></div>\ No newline at end of filediff --git a/plugins/chat/assets/javascripts/discourse/components/chat/thread/participants.hbs b/plugins/chat/assets/javascripts/discourse/components/chat/thread/participants.hbsindex cca09b3f96e..6670bfb536d 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat/thread/participants.hbs+++ b/plugins/chat/assets/javascripts/discourse/components/chat/thread/participants.hbs@@ -1,4 +1,7 @@{{#if (gt @thread.preview.participantUsers.length 1)}}+ <div class="chat-message-thread-indicator__replies-count">+ {{i18n "chat.thread.replies" [email protected]}}+ </div><div class="chat-thread-participants"><div class="chat-thread-participants__avatar-group">{{#each @thread.preview.participantUsers as |user|}}@@ -8,14 +11,11 @@@showPresence={{false}}/>{{/each}}+ {{#if @thread.preview.otherParticipantCount}}+ <div class="chat-thread-participants__other-count">+ +{{@thread.preview.otherParticipantCount}}+ </div>+ {{/if}}</div>- {{#if @thread.preview.otherParticipantCount}}- <div class="chat-thread-participants__other-count">- {{i18n- "chat.thread.participants_other_count"- }}- </div>- {{/if}}</div>{{/if}}\ No newline at end of filediff --git a/plugins/chat/assets/stylesheets/common/chat-message-thread-indicator.scss b/plugins/chat/assets/stylesheets/common/chat-message-thread-indicator.scssindex d700e9ff460..f7d724fc541 100644--- a/plugins/chat/assets/stylesheets/common/chat-message-thread-indicator.scss+++ b/plugins/chat/assets/stylesheets/common/chat-message-thread-indicator.scss@@ -1,14 +1,16 @@+.chat-message {+ container-type: inline-size;+}+.chat-message-thread-indicator {- display: flex;- align-items: center;- gap: 1rem;cursor: pointer;grid-area: threadindicator;- max-width: 1000px;+ box-sizing: border-box;+ display: grid;+ grid-template-columns: auto 1fr auto auto;background-color: var(--primary-very-low);margin: 4px 0 -2px calc(var(--message-left-width) - 0.25rem);- padding-block: 0.5rem;- padding-inline: 0.5rem;+ padding: 0.5rem;border-radius: 8px;color: var(--primary);@@ -21,6 +23,12 @@color: var(--primary);}+ &:hover {+ .chat-message-thread-indicator__replies-count {+ text-decoration: underline;+ }+ }+.touch & {&.-active {box-shadow: var(--shadow-dropdown);@@ -33,70 +41,52 @@}}- &__participants {- flex-shrink: 0;- align-self: flex-start;- }-&__last-reply-avatar {- align-self: flex-start;+ grid-area: avatar;+ margin-right: 0.5rem;+.chat-user-avatar {width: auto !important;}}- &__last-reply-metadata {- display: flex;- align-items: flex-end;- gap: 0.25rem;- color: var(--primary-medium);-- .separator {- font-size: var(--font-down-1);- }- }-- &__last-reply-container {- display: inline-flex;- align-items: flex-end;- font-size: var(--font-down-1);- min-width: 0;-- .relative-date {- @include ellipsis;- }+ &__last-reply-username {+ @include ellipsis;+ font-weight: bold;+ color: var(--primary-very-high);+ margin-right: 0.25rem;}- &__last-reply-user {- font-weight: bold;- color: var(--secondary-low);+ &__last-reply-info {+ grid-area: info;+ display: flex;+ align-items: center;+ gap: 0.25rem;}- &__last-reply-username {- font-weight: bold;- color: var(--secondary-low);+ &__last-reply-timestamp {+ color: var(--primary-high);+ font-size: var(--font-down-2);}&__last-reply-excerpt {@include ellipsis;- line-height: 1.8rem;- }-- &__body {- overflow: hidden;- white-space: nowrap;- flex-shrink: 1;+ grid-area: excerpt;}- &:hover {- .chat-message-thread-indicator__replies-count {- text-decoration: underline;- }+ .chat-thread-participants {+ grid-area: participants;+ flex-shrink: 0;+ display: flex;+ align-items: center;+ justify-content: flex-end;+ gap: 0.5rem;}&__replies-count {@include ellipsis;color: var(--tertiary);font-size: var(--font-down-1);+ text-align: right;}}diff --git a/plugins/chat/assets/stylesheets/common/chat-thread-participants.scss b/plugins/chat/assets/stylesheets/common/chat-thread-participants.scssindex 56a3127ccc2..de5031bed86 100644--- a/plugins/chat/assets/stylesheets/common/chat-thread-participants.scss+++ b/plugins/chat/assets/stylesheets/common/chat-thread-participants.scss@@ -1,14 +1,31 @@.chat-thread-participants {+ margin-left: 0.5rem;&__other-count {+ display: flex;+ align-items: center;+ justify-content: center;+ width: 22px;+ height: 22px;+ border: 1px solid rgba(0, 0, 0, 0);+ box-sizing: border-box;font-size: var(--font-down-2);- text-align: right;- color: var(--primary-medium);+ color: var(--primary-very-low);+ background: var(--secondary-high);+ padding: 0.21em 0.42em;+ border-radius: 1em;+ text-align: center;+ white-space: nowrap;}&__avatar-group {display: flex;+ align-items: center;justify-content: flex-end;+ .chat-user-avatar-container {+ padding: 0;+ }+.chat-user-avatar {width: auto !important;@@ -20,3 +37,29 @@}}}++@container (max-width: 400px) {+ .chat-thread-participants {+ &__avatar-group {+ flex-direction: row-reverse;+ justify-content: flex-start;+ .chat-user-avatar {+ &:not(:first-child) {+ margin-right: -12px;+ }+ .avatar {+ width: 22px;+ height: 22px;+ border: 1px solid var(--primary-very-low);+ }+ }+ }+ &__other-count {+ width: 22px;+ height: 22px;+ margin-right: -12px;+ z-index: 1;+ border: 1px solid var(--primary-very-low);+ }+ }+}diff --git a/plugins/chat/assets/stylesheets/desktop/chat-message-thread-indicator.scss b/plugins/chat/assets/stylesheets/desktop/chat-message-thread-indicator.scssindex 64f84c469d2..7f53cb2a0cb 100644--- a/plugins/chat/assets/stylesheets/desktop/chat-message-thread-indicator.scss+++ b/plugins/chat/assets/stylesheets/desktop/chat-message-thread-indicator.scss@@ -1,59 +1,31 @@.chat-message-thread-indicator {- max-width: 600px;+ grid-template-areas:+ "avatar info replies participants"+ "avatar excerpt excerpt excerpt";- .chat-drawer & {- align-items: stretch;- flex-wrap: wrap;- width: auto;- max-width: 100%;- min-width: auto;- gap: 0.25rem;- }-- &__last-reply-avatar {- .chat-drawer & {- display: inline-block;- }- }-- &__last-reply-user {- margin-right: 0.25rem;-- .chat-drawer & {- display: flex;- align-items: center;- gap: 0.5rem;- margin-right: auto;- }+ &__replies-count {+ display: flex;+ align-self: center;}+}- &__last-reply-metadata {- .chat-drawer & {- flex-wrap: wrap;+@container (max-width: 400px) {+ .chat-message-thread-indicator {+ grid-template-areas:+ "avatar info info participants"+ "excerpt excerpt excerpt replies";+ &__replies-count {+ align-self: flex-start;+ grid-area: replies;+ justify-content: flex-end;}- }-- &__last-reply-excerpt {- .chat-drawer & {+ &__last-reply-excerpt {white-space: wrap;display: -webkit-box;- -webkit-line-clamp: 3;+ -webkit-line-clamp: 2;-webkit-box-orient: vertical;- margin-left: calc(26px + 0.5rem);- }- }-- &__body {- .chat-drawer & {- flex-grow: 1;- }- }- &__participants {- margin-left: auto;-- .chat-drawer & {- align-self: flex-end;- flex-basis: 100%;+ margin-top: 0.5rem;+ margin-right: 0.25rem;}}}diff --git a/plugins/chat/assets/stylesheets/mobile/chat-message-thread-indicator.scss b/plugins/chat/assets/stylesheets/mobile/chat-message-thread-indicator.scssindex e65ee62505d..ff8614ed93c 100644--- a/plugins/chat/assets/stylesheets/mobile/chat-message-thread-indicator.scss+++ b/plugins/chat/assets/stylesheets/mobile/chat-message-thread-indicator.scss@@ -1,39 +1,24 @@.chat-message-thread-indicator {- &__participants,- &__last-reply-avatar:not(.-mobile) {- display: none;- }-- &__last-reply-metadata {- display: flex;- align-items: center;- gap: 0.25rem;- margin-bottom: 0.25rem;- }-- &__last-reply-user {- display: flex;- align-items: center;- gap: 0.5rem;- margin-right: auto;- }+ grid-template-areas:+ "avatar info info participants"+ "excerpt excerpt excerpt replies";- &__last-reply-avatar {- align-self: center;+ .chat-thread-participants {.avatar {- width: 18px;- height: 18px;+ width: 22px;+ height: 22px;}}- &__last-reply-username {- margin-right: auto;- }-&__last-reply-excerpt {white-space: wrap;display: -webkit-box;- -webkit-line-clamp: 3;+ -webkit-line-clamp: 2;-webkit-box-orient: vertical;+ margin-top: 0.5rem;+ margin-right: 0.25rem;+ }+ &__replies-count {+ grid-area: replies;}}