From 2ddf613c580908aa355eef4d897f82bf99405e30 Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Thu, 25 Apr 2024 13:42:46 +0530 Subject: [PATCH] fix: Audio attachment issues (#9260) * fix: Audio attachment issues * chore: Style fix * chore: Minor fix * chore: Minor fix * chore: Review fixes --- .../components/widgets/AttachmentsPreview.vue | 107 ++++++++---------- .../widgets/WootWriter/AudioRecorder.vue | 15 ++- .../widgets/conversation/ReplyBox.vue | 27 +++-- .../conversation/bubble/ImageAudioVideo.vue | 2 +- 4 files changed, 81 insertions(+), 70 deletions(-) diff --git a/app/javascript/dashboard/components/widgets/AttachmentsPreview.vue b/app/javascript/dashboard/components/widgets/AttachmentsPreview.vue index f73474977..32af9e499 100644 --- a/app/javascript/dashboard/components/widgets/AttachmentsPreview.vue +++ b/app/javascript/dashboard/components/widgets/AttachmentsPreview.vue @@ -1,17 +1,17 @@ - + - + 📄 @@ -23,73 +23,62 @@ - + {{ formatFileSize(attachment.resource) }} onRemoveAttachment(index)" + @click="onRemoveAttachment(index)" /> - - diff --git a/app/javascript/dashboard/components/widgets/WootWriter/AudioRecorder.vue b/app/javascript/dashboard/components/widgets/WootWriter/AudioRecorder.vue index 16808ef79..3722ea208 100644 --- a/app/javascript/dashboard/components/widgets/WootWriter/AudioRecorder.vue +++ b/app/javascript/dashboard/components/widgets/WootWriter/AudioRecorder.vue @@ -231,7 +231,18 @@ export default { @apply bg-transparent max-h-60 min-h-[3rem] pt-4 px-0 pb-0 resize-none; } } -.video-js .vjs-control-bar { - background-color: transparent; +// Added to override the default text and bg style to support dark and light mode. +.video-js .vjs-control-bar, +.vjs-record.video-js .vjs-control.vjs-record-indicator:before { + @apply text-slate-600 dark:text-slate-200 bg-transparent dark:bg-transparent; +} +// Added to fix div overlays the screen and takes over the button clicks +// https://github.com/collab-project/videojs-record/issues/688 +// https://github.com/collab-project/videojs-record/pull/709 +.vjs-record.video-js .vjs-control.vjs-record-indicator.vjs-hidden, +.vjs-record.video-js .vjs-control.vjs-record-indicator, +.vjs-record.video-js .vjs-control.vjs-record-indicator:before, +.vjs-record.video-js .vjs-control.vjs-record-indicator:after { + @apply pointer-events-none; } diff --git a/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue b/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue index a0174bf28..c4a9d3032 100644 --- a/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue +++ b/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue @@ -100,7 +100,7 @@ !file?.isRecordedAudio + ); + }, toggleEmojiPicker() { this.showEmojiPicker = !this.showEmojiPicker; }, @@ -944,8 +951,7 @@ export default { this.isRecordingAudio = !this.isRecordingAudio; this.isRecorderAudioStopped = !this.isRecordingAudio; if (!this.isRecordingAudio) { - this.clearMessage(); - this.clearEmailField(); + this.clearRecorder(); } }, toggleAudioRecorderPlayPause() { @@ -989,7 +995,13 @@ export default { } }, onFinishRecorder(file) { - return file && this.onFileUpload(file); + // Added a new key isRecordedAudio to the file to find it's and recorded audio + // Because to filter and show only non recorded audio and other attachments + const autoRecordedFile = { + ...file, + isRecordedAudio: true, + }; + return file && this.onFileUpload(autoRecordedFile); }, toggleTyping(status) { const conversationId = this.currentChat.id; @@ -1015,13 +1027,12 @@ export default { isPrivate: this.isPrivate, thumb: reader.result, blobSignedId: blob ? blob.signed_id : undefined, + isRecordedAudio: file?.isRecordedAudio || false, }); }; }, - removeAttachment(itemIndex) { - this.attachedFiles = this.attachedFiles.filter( - (item, index) => itemIndex !== index - ); + removeAttachment(attachments) { + this.attachedFiles = attachments; }, setReplyToInPayload(payload) { if (this.inReplyTo?.id) { diff --git a/app/javascript/dashboard/components/widgets/conversation/bubble/ImageAudioVideo.vue b/app/javascript/dashboard/components/widgets/conversation/bubble/ImageAudioVideo.vue index a105b63aa..41e207cbf 100644 --- a/app/javascript/dashboard/components/widgets/conversation/bubble/ImageAudioVideo.vue +++ b/app/javascript/dashboard/components/widgets/conversation/bubble/ImageAudioVideo.vue @@ -17,7 +17,7 @@ @error="onImgError" @click="onClick" /> - +