diff --git a/app/javascript/dashboard/components-next/message/bubbles/Image.vue b/app/javascript/dashboard/components-next/message/bubbles/Image.vue index 2484bb06c..20d243841 100644 --- a/app/javascript/dashboard/components-next/message/bubbles/Image.vue +++ b/app/javascript/dashboard/components-next/message/bubbles/Image.vue @@ -5,6 +5,7 @@ import { useAlert } from 'dashboard/composables'; import BaseBubble from './Base.vue'; import Button from 'next/button/Button.vue'; import Icon from 'next/icon/Icon.vue'; +import { useGallery } from '../useGallery'; import { useSnakeCase } from 'dashboard/composables/useTransformKeys'; import { useMessageContext } from '../provider.js'; import { downloadFile } from '@chatwoot/utils'; @@ -21,8 +22,8 @@ const attachment = computed(() => { }); const hasError = ref(false); -const showGallery = ref(false); const isDownloading = ref(false); +const { showGallery, isGalleryAllowed, toggleGallery } = useGallery(); const handleError = () => { hasError.value = true; @@ -46,7 +47,7 @@ const downloadAttachment = async () => { @@ -82,7 +83,7 @@ const downloadAttachment = async () => { { @@ -30,7 +31,7 @@ const isReel = computed(() => { { import { ref } from 'vue'; import Icon from 'next/icon/Icon.vue'; +import { useGallery } from '../useGallery'; import { useSnakeCase } from 'dashboard/composables/useTransformKeys'; import { useMessageContext } from '../provider.js'; @@ -13,7 +14,7 @@ defineProps({ }, }); const hasError = ref(false); -const showGallery = ref(false); +const { showGallery, toggleGallery, isGalleryAllowed } = useGallery(); const { filteredCurrentChatAttachments } = useMessageContext(); @@ -25,7 +26,7 @@ const handleError = () => { { /> -import { ref } from 'vue'; import Icon from 'next/icon/Icon.vue'; +import { useGallery } from '../useGallery'; import { useSnakeCase } from 'dashboard/composables/useTransformKeys'; import { useMessageContext } from '../provider.js'; import GalleryView from 'dashboard/components/widgets/conversation/components/GalleryView.vue'; @@ -12,7 +12,7 @@ defineProps({ }, }); -const showGallery = ref(false); +const { showGallery, isGalleryAllowed, toggleGallery } = useGallery(); const { filteredCurrentChatAttachments } = useMessageContext(); @@ -20,7 +20,7 @@ const { filteredCurrentChatAttachments } = useMessageContext(); { + // eslint-disable-next-line no-underscore-dangle + return !window.__WOOT_ISOLATED_SHELL__; + }); + + const toggleGallery = value => { + if (!isGalleryAllowed.value) return; + + showGallery.value = value; + }; + + return { + showGallery, + isGalleryAllowed, + toggleGallery, + }; +}