diff --git a/app/javascript/dashboard/components-next/message/bubbles/Email.vue b/app/javascript/dashboard/components-next/message/bubbles/Email.vue index f025d466b..02b434da8 100644 --- a/app/javascript/dashboard/components-next/message/bubbles/Email.vue +++ b/app/javascript/dashboard/components-next/message/bubbles/Email.vue @@ -3,7 +3,14 @@ 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 { MESSAGE_STATUS } from '../constants'; +import { ATTACHMENT_TYPES } from '../constants'; const props = defineProps({ content: { @@ -14,6 +21,10 @@ const props = defineProps({ type: Object, default: () => ({}), }, + attachments: { + type: Array, + default: () => [], + }, status: { type: String, required: true, @@ -90,11 +101,35 @@ 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 + ); +});