From 47540fb4e0cc4e86b5ae1454cdcb7cbd42e787fb Mon Sep 17 00:00:00 2001 From: David Battersby Date: Thu, 13 Jun 2024 13:17:12 +0400 Subject: [PATCH] FEATURE: chat drawer navigation improvement (#27419) This change replaces the chat drawer tabs with new drawer routes for channels, direct messages and threads. The main objective is to improve navigation within drawer, now that we have separation of chat sections in drawer. --- .../discourse/components/chat-footer.gjs | 19 +++--- .../components/chat/drawer-routes/channel.gjs | 10 +++- .../chat/drawer-routes/channels.gjs | 25 +------- .../chat/drawer-routes/direct-messages.gjs | 30 ++++++++++ .../components/chat/drawer-routes/threads.gjs | 12 ++-- .../javascripts/discourse/controllers/chat.js | 10 ---- .../discourse/services/chat-drawer-router.js | 5 ++ .../javascripts/discourse/templates/chat.hbs | 5 +- .../stylesheets/mobile/chat-footer.scss | 9 +++ plugins/chat/spec/system/drawer_spec.rb | 59 ++++++++++++++++++- .../page_objects/chat_drawer/chat_drawer.rb | 16 +++++ 11 files changed, 146 insertions(+), 54 deletions(-) create mode 100644 plugins/chat/assets/javascripts/discourse/components/chat/drawer-routes/direct-messages.gjs diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-footer.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-footer.gjs index c3de79f7e9e..484bcebf2db 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat-footer.gjs +++ b/plugins/chat/assets/javascripts/discourse/components/chat-footer.gjs @@ -1,5 +1,4 @@ import Component from "@glimmer/component"; -import { fn } from "@ember/helper"; import { service } from "@ember/service"; import { eq } from "truth-helpers"; import DButton from "discourse/components/d-button"; @@ -14,6 +13,7 @@ import { export default class ChatFooter extends Component { @service router; @service chat; + @service chatHistory; @service siteSettings; @service currentUser; @service chatChannelsManager; @@ -30,6 +30,11 @@ export default class ChatFooter extends Component { return this.chat.userCanAccessDirectMessages; } + get currentRouteName() { + const routeName = this.chatHistory.currentRoute?.name; + return routeName === "chat" ? "chat.channels" : routeName; + } + get shouldRenderFooter() { return ( this.chatStateManager.hasPreloadedChannels && @@ -41,7 +46,7 @@ export default class ChatFooter extends Component { {{#if this.shouldRenderFooter}}