From 7f2b6019f9924bd16a7ae91c6523d576ede3994d Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Wed, 11 Dec 2024 17:38:47 +0530 Subject: [PATCH] feat: handle errors and gallery --- .../components-next/message/bubbles/Image.vue | 53 ++++++++++++++----- .../components-next/message/bubbles/Video.vue | 19 ++++++- .../components-next/message/chips/Image.vue | 38 ++++++++++++- .../components-next/message/chips/Video.vue | 18 +++++++ 4 files changed, 114 insertions(+), 14 deletions(-) diff --git a/app/javascript/dashboard/components-next/message/bubbles/Image.vue b/app/javascript/dashboard/components-next/message/bubbles/Image.vue index 7cdd8106f..67ed53516 100644 --- a/app/javascript/dashboard/components-next/message/bubbles/Image.vue +++ b/app/javascript/dashboard/components-next/message/bubbles/Image.vue @@ -2,6 +2,10 @@ import { ref, computed } from 'vue'; import BaseBubble from './Base.vue'; import Button from 'next/button/Button.vue'; +import Icon from 'next/icon/Icon.vue'; +import { useSnakeCase } from 'dashboard/composables/useTransformKeys'; +import { useMessageContext } from 'next/message/provider.js'; +import GalleryView from 'dashboard/components/widgets/conversation/components/GalleryView.vue'; /** * @typedef {Object} Attachment @@ -36,6 +40,8 @@ const attachment = computed(() => { }); const hasError = ref(false); +const showGallery = ref(false); +const { filteredCurrentChatAttachments } = useMessageContext(); const handleError = () => { hasError.value = true; @@ -57,20 +63,43 @@ const downloadAttachment = async () => { diff --git a/app/javascript/dashboard/components-next/message/bubbles/Video.vue b/app/javascript/dashboard/components-next/message/bubbles/Video.vue index 40168aee7..2d8586111 100644 --- a/app/javascript/dashboard/components-next/message/bubbles/Video.vue +++ b/app/javascript/dashboard/components-next/message/bubbles/Video.vue @@ -2,6 +2,9 @@ import { ref, computed } from 'vue'; import BaseBubble from './Base.vue'; import Icon from 'next/icon/Icon.vue'; +import { useSnakeCase } from 'dashboard/composables/useTransformKeys'; +import { useMessageContext } from 'next/message/provider.js'; +import GalleryView from 'dashboard/components/widgets/conversation/components/GalleryView.vue'; import { ATTACHMENT_TYPES } from '../constants'; /** @@ -31,6 +34,8 @@ const props = defineProps({ }); const emit = defineEmits(['error']); const hasError = ref(false); +const showGallery = ref(false); +const { filteredCurrentChatAttachments } = useMessageContext(); const handleError = () => { hasError.value = true; @@ -47,7 +52,11 @@ const isReel = computed(() => { diff --git a/app/javascript/dashboard/components-next/message/chips/Image.vue b/app/javascript/dashboard/components-next/message/chips/Image.vue index 48be0cb31..d14c54539 100644 --- a/app/javascript/dashboard/components-next/message/chips/Image.vue +++ b/app/javascript/dashboard/components-next/message/chips/Image.vue @@ -1,16 +1,52 @@ diff --git a/app/javascript/dashboard/components-next/message/chips/Video.vue b/app/javascript/dashboard/components-next/message/chips/Video.vue index 2d96522a6..c9904b998 100644 --- a/app/javascript/dashboard/components-next/message/chips/Video.vue +++ b/app/javascript/dashboard/components-next/message/chips/Video.vue @@ -1,16 +1,26 @@