From 788b766179a9b30d1dd0a1b547a3d658cd54cf92 Mon Sep 17 00:00:00 2001 From: Pranav Raj S Date: Wed, 5 Oct 2022 22:00:15 -0700 Subject: [PATCH] feat: Quickly create canned responses (#5563) --- .../widgets/conversation/Message.vue | 9 +-- .../i18n/locale/en/conversation.json | 3 +- .../components/MessageContextMenu.vue | 69 ++++++++++++++++--- .../dashboard/settings/canned/AddCanned.vue | 9 +-- .../FluentIcon/dashboard-icons.json | 3 +- 5 files changed, 71 insertions(+), 22 deletions(-) diff --git a/app/javascript/dashboard/components/widgets/conversation/Message.vue b/app/javascript/dashboard/components/widgets/conversation/Message.vue index 5051a54fa..3481125ca 100644 --- a/app/javascript/dashboard/components/widgets/conversation/Message.vue +++ b/app/javascript/dashboard/components/widgets/conversation/Message.vue @@ -100,10 +100,11 @@ v-if="isBubble && !isMessageDeleted" :is-open="showContextMenu" :show-copy="hasText" + :show-canned-response-option="isOutgoing" :menu-position="contextMenuPosition" + :message-content="data.content" @toggle="handleContextMenuClick" @delete="handleDelete" - @copy="handleCopy" /> @@ -126,7 +127,6 @@ import alertMixin from 'shared/mixins/alertMixin'; import contentTypeMixin from 'shared/mixins/contentTypeMixin'; import { MESSAGE_TYPE, MESSAGE_STATUS } from 'shared/constants/messages'; import { generateBotMessageContent } from './helpers/botMessageContentHelper'; -import { copyTextToClipboard } from 'shared/helpers/clipboard'; export default { components: { @@ -408,11 +408,6 @@ export default { this.showAlert(this.$t('CONVERSATION.FAIL_DELETE_MESSSAGE')); } }, - async handleCopy() { - await copyTextToClipboard(this.data.content); - this.showAlert(this.$t('CONTACT_PANEL.COPY_SUCCESSFUL')); - this.showContextMenu = false; - }, async retrySendMessage() { await this.$store.dispatch('sendMessageWithData', this.data); }, diff --git a/app/javascript/dashboard/i18n/locale/en/conversation.json b/app/javascript/dashboard/i18n/locale/en/conversation.json index f3d5595e7..7c6fa76d5 100644 --- a/app/javascript/dashboard/i18n/locale/en/conversation.json +++ b/app/javascript/dashboard/i18n/locale/en/conversation.json @@ -150,7 +150,8 @@ }, "CONTEXT_MENU": { "COPY": "Copy", - "DELETE": "Delete" + "DELETE": "Delete", + "CREATE_A_CANNED_RESPONSE": "Add to canned responses" } }, "EMAIL_TRANSCRIPT": { diff --git a/app/javascript/dashboard/modules/conversations/components/MessageContextMenu.vue b/app/javascript/dashboard/modules/conversations/components/MessageContextMenu.vue index eb069b163..a50e6bb0d 100644 --- a/app/javascript/dashboard/modules/conversations/components/MessageContextMenu.vue +++ b/app/javascript/dashboard/modules/conversations/components/MessageContextMenu.vue @@ -1,5 +1,15 @@