mirror of
https://github.com/lingble/chatwoot.git
synced 2025-10-29 10:12:34 +00:00
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
This commit is contained in:
@@ -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 = () => {
|
const setupHighlightTimer = () => {
|
||||||
if (Number(route.query.messageId) !== Number(props.id)) {
|
if (Number(route.query.messageId) !== Number(props.id)) {
|
||||||
return;
|
return;
|
||||||
@@ -472,6 +477,7 @@ provideMessageContext({
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-if="!shouldGroupWithNext && shouldShowAvatar"
|
v-if="!shouldGroupWithNext && shouldShowAvatar"
|
||||||
|
v-tooltip.right-end="avatarTooltip"
|
||||||
class="[grid-area:avatar] flex items-end"
|
class="[grid-area:avatar] flex items-end"
|
||||||
>
|
>
|
||||||
<Avatar v-bind="avatarInfo" :size="24" />
|
<Avatar v-bind="avatarInfo" :size="24" />
|
||||||
|
|||||||
@@ -25,16 +25,22 @@ const isPlaying = ref(false);
|
|||||||
const isMuted = ref(false);
|
const isMuted = ref(false);
|
||||||
const currentTime = ref(0);
|
const currentTime = ref(0);
|
||||||
const duration = ref(0);
|
const duration = ref(0);
|
||||||
|
const playbackSpeed = ref(1);
|
||||||
|
|
||||||
const onLoadedMetadata = () => {
|
const onLoadedMetadata = () => {
|
||||||
duration.value = audioPlayer.value?.duration;
|
duration.value = audioPlayer.value?.duration;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const playbackSpeedLabel = computed(() => {
|
||||||
|
return `${playbackSpeed.value}x`;
|
||||||
|
});
|
||||||
|
|
||||||
// There maybe a chance that the audioPlayer ref is not available
|
// There maybe a chance that the audioPlayer ref is not available
|
||||||
// When the onLoadMetadata is called, so we need to set the duration
|
// When the onLoadMetadata is called, so we need to set the duration
|
||||||
// value when the component is mounted
|
// value when the component is mounted
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
duration.value = audioPlayer.value?.duration;
|
duration.value = audioPlayer.value?.duration;
|
||||||
|
audioPlayer.value.playbackRate = playbackSpeed.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
const formatTime = time => {
|
const formatTime = time => {
|
||||||
@@ -72,6 +78,16 @@ const playOrPause = () => {
|
|||||||
const onEnd = () => {
|
const onEnd = () => {
|
||||||
isPlaying.value = false;
|
isPlaying.value = false;
|
||||||
currentTime.value = 0;
|
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 () => {
|
const downloadAudio = async () => {
|
||||||
@@ -106,7 +122,7 @@ const downloadAudio = async () => {
|
|||||||
<div class="tabular-nums text-xs">
|
<div class="tabular-nums text-xs">
|
||||||
{{ formatTime(currentTime) }} / {{ formatTime(duration) }}
|
{{ formatTime(currentTime) }} / {{ formatTime(duration) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center px-2">
|
<div class="flex-1 items-center flex px-2">
|
||||||
<input
|
<input
|
||||||
type="range"
|
type="range"
|
||||||
min="0"
|
min="0"
|
||||||
@@ -116,6 +132,14 @@ const downloadAudio = async () => {
|
|||||||
@input="seek"
|
@input="seek"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<button
|
||||||
|
class="border-0 w-10 h-6 grid place-content-center bg-n-alpha-2 hover:bg-alpha-3 rounded-2xl"
|
||||||
|
@click="changePlaybackSpeed"
|
||||||
|
>
|
||||||
|
<span class="text-xs text-n-slate-11 font-medium">
|
||||||
|
{{ playbackSpeedLabel }}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
class="p-0 border-0 size-8 grid place-content-center"
|
class="p-0 border-0 size-8 grid place-content-center"
|
||||||
@click="toggleMute"
|
@click="toggleMute"
|
||||||
|
|||||||
@@ -55,10 +55,6 @@ const tailwindConfig = {
|
|||||||
},
|
},
|
||||||
overflowWrap: 'anywhere',
|
overflowWrap: 'anywhere',
|
||||||
|
|
||||||
'br + br': {
|
|
||||||
display: 'none',
|
|
||||||
},
|
|
||||||
|
|
||||||
strong: {
|
strong: {
|
||||||
color: 'rgb(var(--slate-12))',
|
color: 'rgb(var(--slate-12))',
|
||||||
fontWeight: '700',
|
fontWeight: '700',
|
||||||
|
|||||||
Reference in New Issue
Block a user