From ab326d10d874df6e8c2f487382cebb6221e26426 Mon Sep 17 00:00:00 2001 From: Jan Cernik <66427541+jancernik@users.noreply.github.com> Date: Tue, 30 Jan 2024 10:18:00 -0300 Subject: [PATCH] FIX: Make long thread titles readable (#25456) When reaching the top of a thread, the full thread title will be displayed if it was too long to fit. It works in mobile, drawer mode, and fullscreen. --------- Co-authored-by: Joffrey JAFFEUX --- .../discourse/components/chat-thread.gjs | 1 + .../chat/drawer-routes/channel-thread.gjs | 19 ++- .../components/chat/drawer-routes/threads.gjs | 5 +- .../components/chat/navbar/index.gjs | 60 +++++++--- .../components/chat/navbar/title.gjs | 16 ++- .../components/chat/routes/channel-thread.gjs | 40 +++++-- .../components/chat/thread/header.gjs | 2 +- .../stylesheets/common/base-common.scss | 3 +- .../stylesheets/common/chat-channel.scss | 2 +- .../stylesheets/common/chat-height-mixin.scss | 9 +- .../stylesheets/common/chat-navbar.scss | 113 ++++++++++++------ .../stylesheets/common/chat-thread.scss | 3 +- .../stylesheets/common/chat-threads-list.scss | 4 +- .../stylesheets/mobile/chat-navbar.scss | 13 ++ 14 files changed, 203 insertions(+), 87 deletions(-) diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-thread.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-thread.gjs index 250ef05e875..090ed48b0a7 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat-thread.gjs +++ b/plugins/chat/assets/javascripts/discourse/components/chat-thread.gjs @@ -150,6 +150,7 @@ export default class ChatThread extends Component { this.isScrolling = false; this.resetIdle(); this.atBottom = state.atBottom; + this.args.setFullTitle?.(state.atTop); if (state.atBottom) { this.fetchMoreMessages({ direction: FUTURE }); diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/drawer-routes/channel-thread.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/drawer-routes/channel-thread.gjs index 91279181580..fea5228ee38 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat/drawer-routes/channel-thread.gjs +++ b/plugins/chat/assets/javascripts/discourse/components/chat/drawer-routes/channel-thread.gjs @@ -1,4 +1,5 @@ import Component from "@glimmer/component"; +import { tracked } from "@glimmer/tracking"; import { array } from "@ember/helper"; import { action } from "@ember/object"; import didInsert from "@ember/render-modifiers/modifiers/did-insert"; @@ -15,6 +16,12 @@ export default class ChatDrawerRoutesChannelThread extends Component { @service chatChannelsManager; @service chatHistory; + @tracked showThreadFullTitle = false; + + get showfullTitle() { + return this.chatStateManager.isDrawerExpanded && this.showThreadFullTitle; + } + get backButton() { const link = { models: this.chat.activeChannel?.routeModels, @@ -65,8 +72,17 @@ export default class ChatDrawerRoutesChannelThread extends Component { } } + @action + setFullTitle(value) { + this.showThreadFullTitle = value; + } +