From 54eab878060a3f29fee51a818427c223a0e9651d Mon Sep 17 00:00:00 2001 From: fayazara Date: Thu, 8 Dec 2022 15:48:25 +0530 Subject: [PATCH] test adding child keys --- .../i18n/locale/en/generalSettings.json | 2 ++ .../dashboard/commands/CommandBarIcons.js | 1 + .../routes/dashboard/commands/commandbar.vue | 4 +++ .../dashboard/commands/goToCommandHotKeys.js | 36 ++++++++++++++----- 4 files changed, 34 insertions(+), 9 deletions(-) diff --git a/app/javascript/dashboard/i18n/locale/en/generalSettings.json b/app/javascript/dashboard/i18n/locale/en/generalSettings.json index f1d87ee73..aebd2c27f 100644 --- a/app/javascript/dashboard/i18n/locale/en/generalSettings.json +++ b/app/javascript/dashboard/i18n/locale/en/generalSettings.json @@ -97,6 +97,7 @@ "SEARCH_PLACEHOLDER": "Search or jump to", "SECTIONS": { "GENERAL": "General", + "CHATWOOT": "Search Chatwoot", "REPORTS": "Reports", "CONVERSATION": "Conversation", "CHANGE_ASSIGNEE": "Change Assignee", @@ -107,6 +108,7 @@ }, "COMMANDS": { "GO_TO_CONVERSATION_DASHBOARD": "Go to Conversation Dashboard", + "SEARCH_EVEYTHING": "Search everything", "GO_TO_CONTACTS_DASHBOARD": "Go to Contacts Dashboard", "GO_TO_REPORTS_OVERVIEW": "Go to Reports Overview", "GO_TO_CONVERSATION_REPORTS": "Go to Conversation Reports", diff --git a/app/javascript/dashboard/routes/dashboard/commands/CommandBarIcons.js b/app/javascript/dashboard/routes/dashboard/commands/CommandBarIcons.js index d0d0bb633..50da8b920 100644 --- a/app/javascript/dashboard/routes/dashboard/commands/CommandBarIcons.js +++ b/app/javascript/dashboard/routes/dashboard/commands/CommandBarIcons.js @@ -26,3 +26,4 @@ export const ICON_LABELS = ``; export const ICON_INBOXES = ``; export const ICON_APPS = ``; +export const SEARCH = ``; diff --git a/app/javascript/dashboard/routes/dashboard/commands/commandbar.vue b/app/javascript/dashboard/routes/dashboard/commands/commandbar.vue index b11f9b947..1d794d02a 100644 --- a/app/javascript/dashboard/routes/dashboard/commands/commandbar.vue +++ b/app/javascript/dashboard/routes/dashboard/commands/commandbar.vue @@ -6,6 +6,7 @@ hideBreadcrumbs :placeholder="placeholder" @selected="setCommandbarData" + @change="onChange" /> @@ -56,6 +57,9 @@ export default { setCommandbarData() { this.$refs.ninjakeys.data = this.hotKeys; }, + onChange(ninjaKeyInstance) { + // console.log(ninjaKeyInstance); + }, }, }; diff --git a/app/javascript/dashboard/routes/dashboard/commands/goToCommandHotKeys.js b/app/javascript/dashboard/routes/dashboard/commands/goToCommandHotKeys.js index b1d17dcbb..6c6186482 100644 --- a/app/javascript/dashboard/routes/dashboard/commands/goToCommandHotKeys.js +++ b/app/javascript/dashboard/routes/dashboard/commands/goToCommandHotKeys.js @@ -20,6 +20,14 @@ import { mapGetters } from 'vuex'; import { FEATURE_FLAGS } from '../../../featureFlags'; const GO_TO_COMMANDS = [ + { + id: 'search_everything', + title: 'COMMAND_BAR.COMMANDS.SEARCH_EVEYTHING', + section: 'COMMAND_BAR.SECTIONS.CHATWOOT', + icon: ICON_CONVERSATION_DASHBOARD, + children: ['Light Theme', 'Dark Theme', 'System Theme'], + role: ['agent'], + }, { id: 'goto_conversation_dashboard', title: 'COMMAND_BAR.COMMANDS.GO_TO_CONVERSATION_DASHBOARD', @@ -180,18 +188,28 @@ export default { } return true; }); - if (!this.isAdmin) { commands = commands.filter(command => command.role.includes('agent')); } - - return commands.map(command => ({ - id: command.id, - section: this.$t(command.section), - title: this.$t(command.title), - icon: command.icon, - handler: () => this.openRoute(command.path(this.accountId)), - })); + return commands.map(command => { + return { + id: command.id, + section: this.$t(command.section), + title: this.$t(command.title), + icon: command.icon, + children: command.children, + handler: () => { + if (command.children) { + // const ninja = this.$refs.ninjakeys; + const ninja = document.querySelector('ninja-keys'); + ninja.open({ parent: command.id }); + return { keepOpen: true }; + } else { + this.openRoute(command.path(this.accountId)); + } + }, + }; + }); }, }, methods: {