From 73f6b888cd2a4707ae39e427d89ee08a4c191458 Mon Sep 17 00:00:00 2001 From: Pranav Date: Thu, 20 Feb 2025 20:21:54 -0800 Subject: [PATCH] fix: Fix issues in bubble design (#10940) Just making it easier to test and merge https://github.com/chatwoot/chatwoot/pull/10796. This PR does the following: - Removes the change on br + br condition. - Support 1x, 1.5x, 2x playbacks - Add a hover on the agent avatar --- .../components-next/message/Message.vue | 6 +++++ .../components-next/message/chips/Audio.vue | 26 ++++++++++++++++++- tailwind.config.js | 4 --- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/app/javascript/dashboard/components-next/message/Message.vue b/app/javascript/dashboard/components-next/message/Message.vue index df0602a49..9d6b30f81 100644 --- a/app/javascript/dashboard/components-next/message/Message.vue +++ b/app/javascript/dashboard/components-next/message/Message.vue @@ -414,6 +414,11 @@ const avatarInfo = computed(() => { }; }); +const avatarTooltip = computed(() => { + if (avatarInfo.value.name === '') return ''; + return `${t('CONVERSATION.SENT_BY')} ${avatarInfo.value.name}`; +}); + const setupHighlightTimer = () => { if (Number(route.query.messageId) !== Number(props.id)) { return; @@ -472,6 +477,7 @@ provideMessageContext({ >
diff --git a/app/javascript/dashboard/components-next/message/chips/Audio.vue b/app/javascript/dashboard/components-next/message/chips/Audio.vue index 0d91fb84c..680584048 100644 --- a/app/javascript/dashboard/components-next/message/chips/Audio.vue +++ b/app/javascript/dashboard/components-next/message/chips/Audio.vue @@ -25,16 +25,22 @@ const isPlaying = ref(false); const isMuted = ref(false); const currentTime = ref(0); const duration = ref(0); +const playbackSpeed = ref(1); const onLoadedMetadata = () => { duration.value = audioPlayer.value?.duration; }; +const playbackSpeedLabel = computed(() => { + return `${playbackSpeed.value}x`; +}); + // There maybe a chance that the audioPlayer ref is not available // When the onLoadMetadata is called, so we need to set the duration // value when the component is mounted onMounted(() => { duration.value = audioPlayer.value?.duration; + audioPlayer.value.playbackRate = playbackSpeed.value; }); const formatTime = time => { @@ -72,6 +78,16 @@ const playOrPause = () => { const onEnd = () => { isPlaying.value = false; currentTime.value = 0; + playbackSpeed.value = 1; + audioPlayer.value.playbackRate = 1; +}; + +const changePlaybackSpeed = () => { + const speeds = [1, 1.5, 2]; + const currentIndex = speeds.indexOf(playbackSpeed.value); + const nextIndex = (currentIndex + 1) % speeds.length; + playbackSpeed.value = speeds[nextIndex]; + audioPlayer.value.playbackRate = playbackSpeed.value; }; const downloadAudio = async () => { @@ -106,7 +122,7 @@ const downloadAudio = async () => {
{{ formatTime(currentTime) }} / {{ formatTime(duration) }}
-
+
{ @input="seek" />
+