From 89956d006cb7dc5d9135a6ce939e982e1a5b8d3a Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Wed, 4 Dec 2024 17:46:28 +0530 Subject: [PATCH] feat: common attachment chips --- .../message/bubbles/Attachments.vue | 62 +------------ .../components-next/message/bubbles/Email.vue | 59 +----------- .../components-next/message/bubbles/Text.vue | 60 +----------- .../message/chips/AttachmentChips.vue | 92 +++++++++++++++++++ 4 files changed, 100 insertions(+), 173 deletions(-) create mode 100644 app/javascript/dashboard/components-next/message/chips/AttachmentChips.vue diff --git a/app/javascript/dashboard/components-next/message/bubbles/Attachments.vue b/app/javascript/dashboard/components-next/message/bubbles/Attachments.vue index d3cfb6c1d..1dcdf21d7 100644 --- a/app/javascript/dashboard/components-next/message/bubbles/Attachments.vue +++ b/app/javascript/dashboard/components-next/message/bubbles/Attachments.vue @@ -1,13 +1,7 @@ diff --git a/app/javascript/dashboard/components-next/message/bubbles/Email.vue b/app/javascript/dashboard/components-next/message/bubbles/Email.vue index 3863405df..a61d95d6d 100644 --- a/app/javascript/dashboard/components-next/message/bubbles/Email.vue +++ b/app/javascript/dashboard/components-next/message/bubbles/Email.vue @@ -3,14 +3,9 @@ import { computed, useTemplateRef, ref, watch } from 'vue'; import { Letter } from 'vue-letter'; import Icon from 'next/icon/Icon.vue'; import BaseBubble from 'next/message/bubbles/Base.vue'; - -import ImageChip from 'next/message/chips/Image.vue'; -import VideoChip from 'next/message/chips/Video.vue'; -import AudioChip from 'next/message/chips/Audio.vue'; -import FileChip from 'next/message/chips/File.vue'; +import AttachmentChips from 'next/message/chips/AttachmentChips.vue'; import { MESSAGE_STATUS } from '../constants'; -import { ATTACHMENT_TYPES } from '../constants'; const props = defineProps({ content: { @@ -101,30 +96,6 @@ const showMeta = computed(() => { subject.value ); }); - -const mediaAttachments = computed(() => { - const allowedTypes = [ATTACHMENT_TYPES.IMAGE, ATTACHMENT_TYPES.VIDEO]; - const mediaTypes = props.attachments.filter(attachment => - allowedTypes.includes(attachment.fileType) - ); - - return mediaTypes.sort( - (a, b) => - allowedTypes.indexOf(a.fileType) - allowedTypes.indexOf(b.fileType) - ); -}); - -const recordings = computed(() => { - return props.attachments.filter( - attachment => attachment.fileType === ATTACHMENT_TYPES.AUDIO - ); -}); - -const files = computed(() => { - return props.attachments.filter( - attachment => attachment.fileType === ATTACHMENT_TYPES.FILE - ); -}); diff --git a/app/javascript/dashboard/components-next/message/bubbles/Text.vue b/app/javascript/dashboard/components-next/message/bubbles/Text.vue index 8d8231512..b269264e1 100644 --- a/app/javascript/dashboard/components-next/message/bubbles/Text.vue +++ b/app/javascript/dashboard/components-next/message/bubbles/Text.vue @@ -1,15 +1,11 @@ diff --git a/app/javascript/dashboard/components-next/message/chips/AttachmentChips.vue b/app/javascript/dashboard/components-next/message/chips/AttachmentChips.vue new file mode 100644 index 000000000..0a14b4666 --- /dev/null +++ b/app/javascript/dashboard/components-next/message/chips/AttachmentChips.vue @@ -0,0 +1,92 @@ + + +