From 98f1dd46f497d0950f7caee6fc5356e9546bf14b Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Wed, 11 Dec 2024 17:36:55 +0530 Subject: [PATCH] feat: common base attachment component --- .../message/bubbles/BaseAttachment.vue | 74 +++++++++++++++++++ .../message/bubbles/Contact.vue | 45 ++++------- .../components-next/message/bubbles/File.vue | 51 ++++--------- .../message/bubbles/Location.vue | 44 ++++------- 4 files changed, 120 insertions(+), 94 deletions(-) create mode 100644 app/javascript/dashboard/components-next/message/bubbles/BaseAttachment.vue diff --git a/app/javascript/dashboard/components-next/message/bubbles/BaseAttachment.vue b/app/javascript/dashboard/components-next/message/bubbles/BaseAttachment.vue new file mode 100644 index 000000000..59cf576bf --- /dev/null +++ b/app/javascript/dashboard/components-next/message/bubbles/BaseAttachment.vue @@ -0,0 +1,74 @@ + + + + diff --git a/app/javascript/dashboard/components-next/message/bubbles/Contact.vue b/app/javascript/dashboard/components-next/message/bubbles/Contact.vue index 83cf69eab..ce16e1b1e 100644 --- a/app/javascript/dashboard/components-next/message/bubbles/Contact.vue +++ b/app/javascript/dashboard/components-next/message/bubbles/Contact.vue @@ -3,8 +3,7 @@ import { computed } from 'vue'; import { useAlert } from 'dashboard/composables'; import { useStore } from 'dashboard/composables/store'; import { useI18n } from 'vue-i18n'; -import BaseBubble from './Base.vue'; -import Icon from 'next/icon/Icon.vue'; +import BaseAttachmentBubble from './BaseAttachment.vue'; import { DuplicateContactException, @@ -52,10 +51,6 @@ const attachment = computed(() => { return props.attachments[0]; }); -const senderName = computed(() => { - return props.sender.name; -}); - const phoneNumber = computed(() => { return attachment.value.fallbackTitle; }); @@ -123,32 +118,20 @@ async function addContact() { } } } + +const action = computed(() => ({ + label: t('CONVERSATION.SAVE_CONTACT'), + onClick: addContact, +})); diff --git a/app/javascript/dashboard/components-next/message/bubbles/File.vue b/app/javascript/dashboard/components-next/message/bubbles/File.vue index 160101d50..c58642f0f 100644 --- a/app/javascript/dashboard/components-next/message/bubbles/File.vue +++ b/app/javascript/dashboard/components-next/message/bubbles/File.vue @@ -2,7 +2,7 @@ import { computed } from 'vue'; import { useI18n } from 'vue-i18n'; -import BaseBubble from './Base.vue'; +import BaseAttachmentBubble from './BaseAttachment.vue'; import FileIcon from 'next/icon/FileIcon.vue'; /** @@ -41,10 +41,6 @@ const url = computed(() => { return props.attachments[0].dataUrl; }); -const senderName = computed(() => { - return props.sender.name; -}); - const fileName = computed(() => { if (url.value) { const filename = url.value.substring(url.value.lastIndexOf('/') + 1); @@ -59,34 +55,19 @@ const fileType = computed(() => { diff --git a/app/javascript/dashboard/components-next/message/bubbles/Location.vue b/app/javascript/dashboard/components-next/message/bubbles/Location.vue index f9bec5f37..e6678dcc0 100644 --- a/app/javascript/dashboard/components-next/message/bubbles/Location.vue +++ b/app/javascript/dashboard/components-next/message/bubbles/Location.vue @@ -1,6 +1,6 @@