From 228167823c5b415439a5d9fca3fb96ba75280d32 Mon Sep 17 00:00:00 2001 From: fayazara Date: Mon, 12 Dec 2022 23:20:08 +0530 Subject: [PATCH] Fix intendation --- .../routes/dashboard/commands/commandbar.vue | 22 ++++++++++++---- .../dashboard/commands/goToCommandHotKeys.js | 21 ++++++++++------ yarn.lock | 25 ++++++++++++++++--- 3 files changed, 51 insertions(+), 17 deletions(-) diff --git a/app/javascript/dashboard/routes/dashboard/commands/commandbar.vue b/app/javascript/dashboard/routes/dashboard/commands/commandbar.vue index 40930b7c4..c17de3cd9 100644 --- a/app/javascript/dashboard/routes/dashboard/commands/commandbar.vue +++ b/app/javascript/dashboard/routes/dashboard/commands/commandbar.vue @@ -18,6 +18,7 @@ import agentMixin from 'dashboard/mixins/agentMixin'; import conversationLabelMixin from 'dashboard/mixins/conversation/labelMixin'; import conversationTeamMixin from 'dashboard/mixins/conversation/teamMixin'; import adminMixin from 'dashboard/mixins/isAdmin'; +import { frontendURL } from '../../../helper/URLHelper'; export default { mixins: [ @@ -56,16 +57,27 @@ export default { methods: { setCommandbarData(e) { if (e && e.detail.action.id && e.detail.action.title) { - console.log({ id: e.detail.action.id, title: e.detail.action.id }); + const action = e.detail.action; + if (action.type === 'contact') { + this.$refs.ninjakeys.close(); + this.$router.push( + frontendURL(`accounts/${this.accountId}/contacts/${action.key}`) + ); + } else if (action.type === 'message') { + this.$refs.ninjakeys.close(); + this.$router.push( + frontendURL( + `accounts/${this.accountId}/conversations/${action.key}` + ) + ); + } + } else { + this.$refs.ninjakeys.data = this.hotKeys; } - this.$refs.ninjakeys.data = this.hotKeys; }, onChange(ninjaKeyInstance) { // console.log(ninjaKeyInstance); }, - searchEverything(query) { - console.log(query); - }, }, }; diff --git a/app/javascript/dashboard/routes/dashboard/commands/goToCommandHotKeys.js b/app/javascript/dashboard/routes/dashboard/commands/goToCommandHotKeys.js index 1b89ccd55..2d24de5c6 100644 --- a/app/javascript/dashboard/routes/dashboard/commands/goToCommandHotKeys.js +++ b/app/javascript/dashboard/routes/dashboard/commands/goToCommandHotKeys.js @@ -27,7 +27,7 @@ const GO_TO_COMMANDS = [ icon: ICON_CONVERSATION_DASHBOARD, builder: searchKey => { return new Promise(resolve => { - fetch(`/api/v1/accounts/3/conversations/text_search?q=${searchKey}`, { + fetch(`/api/v1/accounts/1/conversations/text_search?q=${searchKey}`, { headers: { 'Content-Type': 'application/json', api_access_token: '', @@ -35,13 +35,18 @@ const GO_TO_COMMANDS = [ }) .then(res => res.json()) .then(data => { - const { results } = data; - resolve( - results.payload.contacts.map(result => ({ - id: result.id, - title: result.name, - })) - ); + const contacts = data.payload.contacts.map(result => ({ + id: result.id, + title: result.name, + type: 'contact', + })); + const messages = data.payload.messages.map(result => ({ + id: result.conversation_id, + title: result.content, + type: 'message', + })); + const flattened = [...contacts, ...messages]; + return resolve(flattened); }) .catch(error => { resolve([]); diff --git a/yarn.lock b/yarn.lock index 3fe2549da..665c9d0c9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1783,10 +1783,27 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" -"@lit/reactive-element@^1.0.0", "@lit/reactive-element@^1.1.0": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@lit/reactive-element/-/reactive-element-1.1.1.tgz#523b29e529e881fce47bab764ea1b8058fd45796" - integrity sha512-B2JdRMwCGv+VpIRj3CYVQBx3muPDeE8y+HPgWqzrAHsO5/40BpwDFZeplIV790BaTqDVUDvZOKMSbuFM9zWC0w== +"@june-so/analytics-next@^1.36.5": + version "1.36.5" + resolved "https://registry.yarnpkg.com/@june-so/analytics-next/-/analytics-next-1.36.5.tgz#030ba5a7f8fa232597185cdb706e40b7036ca7f8" + integrity sha512-r2sp4VDngeX/ItQrlgmdKpmghg3OmPvhnTOKJ1huaHbFM2uPELpfnMRRngUVzbgbMoMeTf8QtgQVMjnUsl7G1A== + dependencies: + "@lukeed/uuid" "^2.0.0" + "@segment/analytics.js-video-plugins" "^0.2.1" + "@segment/facade" "3.4.7" + "@segment/tsub" "^0.1.9" + dset "^3.0.0" + encoding "^0.1.13" + js-cookie "^2.2.1" + node-fetch "^2.6.1" + spark-md5 "^3.0.1" + tslib "^2.1.0" + unfetch "^4.1.0" + +"@lit/reactive-element@^1.3.0", "@lit/reactive-element@^1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@lit/reactive-element/-/reactive-element-1.5.0.tgz#344cc33f2d1491d094b8ef824a9fe31d150d2375" + integrity sha512-fQh9FDK0LPTwDk+0HhSZEtb8K0LTN1wXerwpGrWA+a8tWulYRDLI4vQDWp4GOIsewn0572KYV/oZ3+492D7osA== "@lukeed/csprng@^1.0.0": version "1.0.1"