From 26b5c2c1364186cb3409d758cbcf71bb9a8737f6 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Thu, 5 Dec 2024 15:08:37 +0530 Subject: [PATCH] feat: setup instagram --- .../components-next/message/Message.vue | 5 + .../components-next/message/bubbles/Image.vue | 9 +- .../message/bubbles/InstagramStory.vue | 91 +++++ .../components-next/message/bubbles/Video.vue | 11 +- .../message/fixtures/instagramConversation.js | 381 +++++++----------- 5 files changed, 260 insertions(+), 237 deletions(-) create mode 100644 app/javascript/dashboard/components-next/message/bubbles/InstagramStory.vue diff --git a/app/javascript/dashboard/components-next/message/Message.vue b/app/javascript/dashboard/components-next/message/Message.vue index ef5f7bbe3..2cd868601 100644 --- a/app/javascript/dashboard/components-next/message/Message.vue +++ b/app/javascript/dashboard/components-next/message/Message.vue @@ -18,6 +18,7 @@ import ImageBubble from './bubbles/Image.vue'; import FileBubble from './bubbles/File.vue'; import AudioBubble from './bubbles/Audio.vue'; import VideoBubble from './bubbles/Video.vue'; +import InstagramStoryBubble from './bubbles/InstagramStory.vue'; import AttachmentsBubble from './bubbles/Attachments.vue'; import EmailBubble from './bubbles/Email/Index.vue'; @@ -238,6 +239,10 @@ const componentToRender = computed(() => { if (emailInboxTypes.includes(props.messageType)) return EmailBubble; } + if (props.contentAttributes.imageType === 'story_mention') { + return InstagramStoryBubble; + } + if (props.attachments.length === 1 && !props.content) { const fileType = props.attachments[0].fileType; if (fileType === ATTACHMENT_TYPES.IMAGE) return ImageBubble; diff --git a/app/javascript/dashboard/components-next/message/bubbles/Image.vue b/app/javascript/dashboard/components-next/message/bubbles/Image.vue index 5d3770ce4..7cdd8106f 100644 --- a/app/javascript/dashboard/components-next/message/bubbles/Image.vue +++ b/app/javascript/dashboard/components-next/message/bubbles/Image.vue @@ -29,12 +29,19 @@ const props = defineProps({ }, }); +const emit = defineEmits(['error']); + const attachment = computed(() => { return props.attachments[0]; }); const hasError = ref(false); +const handleError = () => { + hasError.value = true; + emit('error'); +}; + const downloadAttachment = async () => { const response = await fetch(attachment.value.dataUrl); const blob = await response.blob(); @@ -51,7 +58,7 @@ const downloadAttachment = async () => {