From cfd72fa65c59f8c96a2f6e7c106655e4f8d2995e Mon Sep 17 00:00:00 2001 From: chapoi <101828855+chapoi@users.noreply.github.com> Date: Mon, 11 Mar 2024 11:59:40 +0200 Subject: [PATCH] UX: remove last reply from My Threads preview + restyle (#25568) On mobile, when viewing the My Threads area, each thread will show: - The avatar of the last responder in the thread, overlaid with the chat thread symbol to visually distinguish this area from DMs. - Either the thread title, where applicable, or the first message of the thread, truncated to fit on one line. - The channel where the thread originated. - The last message sent in the thread, truncated to fit on one line. - When the last message was sent in the thread. --------- Co-authored-by: David Battersby --- .../components/channel-icon/index.gjs | 17 +++++ .../components/chat/thread/header.gjs | 18 +++-- .../components/user-threads/index.gjs | 26 +++++-- .../components/user-threads/preview.gjs | 23 ++++++ .../stylesheets/mobile/chat-user-threads.scss | 72 +++++++++++++++++-- plugins/chat/spec/system/user_threads_spec.rb | 18 +++++ 6 files changed, 155 insertions(+), 19 deletions(-) create mode 100644 plugins/chat/assets/javascripts/discourse/components/user-threads/preview.gjs diff --git a/plugins/chat/assets/javascripts/discourse/components/channel-icon/index.gjs b/plugins/chat/assets/javascripts/discourse/components/channel-icon/index.gjs index a014679d985..e704540ce84 100644 --- a/plugins/chat/assets/javascripts/discourse/components/channel-icon/index.gjs +++ b/plugins/chat/assets/javascripts/discourse/components/channel-icon/index.gjs @@ -19,6 +19,10 @@ export default class ChatChannelIcon extends Component { return htmlSafe(`color: #${this.args.channel.chatable.color}`); } + get isThreadsList() { + return this.args.thread ?? false; + } + } diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/thread/header.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/thread/header.gjs index 48181cbb782..c654b0d7605 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat/thread/header.gjs +++ b/plugins/chat/assets/javascripts/discourse/components/chat/thread/header.gjs @@ -24,14 +24,14 @@ export default class ChatThreadHeader extends Component { route = "chat.channel.threads"; title = I18n.t("chat.return_to_threads_list"); models = this.channel?.routeModels; - } else if (!this.currentUser.isInDoNotDisturb() && this.unreadCount > 0) { - route = "chat.channel.threads"; - title = I18n.t("chat.return_to_threads_list"); - models = this.channel?.routeModels; } else if (prevPage === "chat.threads") { route = "chat.threads"; title = I18n.t("chat.my_threads.title"); models = []; + } else if (!this.currentUser.isInDoNotDisturb() && this.unreadCount > 0) { + route = "chat.channel.threads"; + title = I18n.t("chat.return_to_threads_list"); + models = this.channel?.routeModels; } else { route = "chat.channel.index"; title = I18n.t("chat.return_to_channel"); @@ -53,6 +53,12 @@ export default class ChatThreadHeader extends Component { return this.channel?.threadsManager?.unreadThreadCount; } + get showThreadUnreadIndicator() { + return ( + this.backLink.route === "chat.channel.threads" && this.unreadCount > 0 + ); + } +