refactor: handle missing message content

This commit is contained in:
Shivam Mishra
2023-10-10 19:18:34 +05:30
parent 53ac68f0c0
commit 86ea2bbbe3
3 changed files with 18 additions and 9 deletions
@@ -5,11 +5,13 @@ import { extractTextFromMarkdown } from 'dashboard/helper/editorHelper';
const { content } = defineProps({
content: {
type: String,
required: true,
default: '',
},
});
const cleanedContent = computed(() => extractTextFromMarkdown(content));
const defaultEmptyMessage = this.$t('CONVERSATION.REPLY_MESSAGE_NOT_FOUND');
</script>
<template>
@@ -17,6 +19,9 @@ const cleanedContent = computed(() => extractTextFromMarkdown(content));
class="p-2 -mx-2 overflow-hidden rounded-md bg-woot-600 line-clamp-3 min-w-[15rem] mb-2 cursor-pointer"
@click="$emit('click')"
>
{{ cleanedContent }}
<template v-if="content">
{{ cleanedContent }}
</template>
<template v-else> {{ defaultEmptyMessage }} </template>
</div>
</template>