UX: highlight the chat channel/DM only when chat is expanded (#28488)

This commit is contained in:
Jan Cernik 2024-08-27 07:50:36 -05:00 committed by GitHub
parent 437d7a0ad1
commit a12b933f5c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 2 deletions

View File

@ -51,6 +51,7 @@ export default {
const chatChannelsManager = container.lookup(
"service:chat-channels-manager"
);
const chatStateManager = container.lookup("service:chat-state-manager");
api.addSidebarSection(
(BaseCustomSidebarSection, BaseCustomSidebarSectionLink) => {
@ -119,6 +120,7 @@ export default {
super(...arguments);
this.channel = channel;
this.chatService = chatService;
this.chatStateManager = chatStateManager;
}
get name() {
@ -132,7 +134,11 @@ export default {
classes.push("sidebar-section-link--muted");
}
if (this.channel.id === this.chatService.activeChannel?.id) {
if (
this.channel.id === this.chatService.activeChannel?.id &&
(this.chatStateManager.isDrawerExpanded ||
this.chatStateManager.isFullPageActive)
) {
classes.push("sidebar-section-link--active");
}
@ -289,6 +295,7 @@ export default {
this.channel = channel;
this.chatService = chatService;
this.currentUser = currentUser;
this.chatStateManager = chatStateManager;
if (this.oneOnOneMessage) {
const user = this.channel.chatable.users[0];
@ -330,7 +337,11 @@ export default {
classes.push("sidebar-section-link--muted");
}
if (this.channel.id === this.chatService.activeChannel?.id) {
if (
this.channel.id === this.chatService.activeChannel?.id &&
(this.chatStateManager.isDrawerExpanded ||
this.chatStateManager.isFullPageActive)
) {
classes.push("sidebar-section-link--active");
}