diff --git a/app/javascript/dashboard/components/ChatList.vue b/app/javascript/dashboard/components/ChatList.vue index 937c43a0b..23fefb8ff 100644 --- a/app/javascript/dashboard/components/ChatList.vue +++ b/app/javascript/dashboard/components/ChatList.vue @@ -187,6 +187,10 @@ import { hasPressedAltAndKKey, } from 'shared/helpers/KeyboardHelpers'; import { conversationListPageURL } from '../helper/URLHelper'; +import { + isOnMentionsView, + isOnUnattendedView, +} from '../store/modules/conversations/helpers/actionHelpers'; export default { components: { @@ -649,10 +653,16 @@ export default { params: { accountId, inbox_id: inboxId, label, teamId }, name, } = this.$route; + let conversationType = ''; + if (isOnMentionsView({ route: { name } })) { + conversationType = 'mention'; + } else if (isOnUnattendedView({ route: { name } })) { + conversationType = 'unattended'; + } this.$router.push( conversationListPageURL({ accountId, - conversationType: name === 'conversation_mentions' ? 'mention' : '', + conversationType: conversationType, customViewId: this.foldersId, inboxId, label, diff --git a/app/javascript/dashboard/components/layout/sidebarComponents/SecondaryNavItem.vue b/app/javascript/dashboard/components/layout/sidebarComponents/SecondaryNavItem.vue index 644258f50..4336b2ebf 100644 --- a/app/javascript/dashboard/components/layout/sidebarComponents/SecondaryNavItem.vue +++ b/app/javascript/dashboard/components/layout/sidebarComponents/SecondaryNavItem.vue @@ -87,6 +87,10 @@ import { } from 'dashboard/helper/inbox'; import SecondaryChildNavItem from './SecondaryChildNavItem'; +import { + isOnMentionsView, + isOnUnattendedView, +} from '../../../store/modules/conversations/helpers/actionHelpers'; export default { components: { SecondaryChildNavItem }, @@ -115,19 +119,31 @@ export default { this.menuItem.featureFlag ); }, - isInboxConversation() { + isAllConversations() { return ( this.$store.state.route.name === 'inbox_conversation' && this.menuItem.toStateName === 'home' ); }, + isMentions() { + return ( + isOnMentionsView({ route: this.$route }) && + this.menuItem.toStateName === 'conversation_mentions' + ); + }, + isUnattended() { + return ( + isOnUnattendedView({ route: this.$route }) && + this.menuItem.toStateName === 'conversation_unattended' + ); + }, isTeamsSettings() { return ( this.$store.state.route.name === 'settings_teams_edit' && this.menuItem.toStateName === 'settings_teams_list' ); }, - isInboxsSettings() { + isInboxSettings() { return ( this.$store.state.route.name === 'settings_inbox_show' && this.menuItem.toStateName === 'settings_inbox_list' @@ -150,14 +166,20 @@ export default { }, computedClass() { - // If active Inbox is present - // donot highlight conversations + // If active inbox is present, do not highlight conversations if (this.activeInbox) return ' '; + if ( + this.isAllConversations || + this.isMentions || + this.isUnattended || + this.isCurrentRoute + ) { + return 'is-active'; + } if (this.hasSubMenu) { if ( - this.isInboxConversation || this.isTeamsSettings || - this.isInboxsSettings || + this.isInboxSettings || this.isIntegrationsSettings || this.isApplicationsSettings ) { @@ -166,10 +188,6 @@ export default { return ' '; } - if (this.isCurrentRoute) { - return 'is-active'; - } - return ''; }, }, diff --git a/app/javascript/dashboard/helper/URLHelper.js b/app/javascript/dashboard/helper/URLHelper.js index ebc54f289..f181ff761 100644 --- a/app/javascript/dashboard/helper/URLHelper.js +++ b/app/javascript/dashboard/helper/URLHelper.js @@ -75,12 +75,16 @@ export const conversationListPageURL = ({ url = `accounts/${accountId}/label/${label}`; } else if (teamId) { url = `accounts/${accountId}/team/${teamId}`; - } else if (conversationType === 'mention') { - url = `accounts/${accountId}/mentions/conversations`; } else if (inboxId) { url = `accounts/${accountId}/inbox/${inboxId}`; } else if (customViewId) { url = `accounts/${accountId}/custom_view/${customViewId}`; + } else if (conversationType) { + const urlMap = { + mention: 'mentions/conversations', + unattended: 'unattended/conversations', + }; + url = `accounts/${accountId}/${urlMap[conversationType]}`; } return frontendURL(url); }; diff --git a/app/javascript/dashboard/routes/dashboard/commands/conversationHotKeys.js b/app/javascript/dashboard/routes/dashboard/commands/conversationHotKeys.js index 4d1e1cfd7..c8511352b 100644 --- a/app/javascript/dashboard/routes/dashboard/commands/conversationHotKeys.js +++ b/app/javascript/dashboard/routes/dashboard/commands/conversationHotKeys.js @@ -99,6 +99,8 @@ const MUTE_ACTION = { export const isAConversationRoute = routeName => [ 'inbox_conversation', + 'conversation_through_mentions', + 'conversation_through_unattended', 'conversation_through_inbox', 'conversations_through_label', 'conversations_through_team',