Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement message bubble reply to (#8068)
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
- Loading branch information
1 parent
0bc2087
commit 7ffa669
Showing
9 changed files
with
205 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
app/javascript/dashboard/components/widgets/conversation/MessagePreview.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<template> | ||
<div class="overflow-hidden text-ellipsis whitespace-nowrap"> | ||
<template v-if="showMessageType"> | ||
<fluent-icon | ||
v-if="isMessagePrivate" | ||
size="16" | ||
class="-mt-0.5 align-middle text-slate-600 dark:text-slate-300 inline-block" | ||
icon="lock-closed" | ||
/> | ||
<fluent-icon | ||
v-else-if="messageByAgent" | ||
size="16" | ||
class="-mt-0.5 align-middle text-slate-600 dark:text-slate-300 inline-block" | ||
icon="arrow-reply" | ||
/> | ||
<fluent-icon | ||
v-else-if="isMessageAnActivity" | ||
size="16" | ||
class="-mt-0.5 align-middle text-slate-600 dark:text-slate-300 inline-block" | ||
icon="info" | ||
/> | ||
</template> | ||
<span v-if="message.content"> | ||
{{ parsedLastMessage }} | ||
</span> | ||
<span v-else-if="message.attachments"> | ||
<fluent-icon | ||
v-if="attachmentIcon && showMessageType" | ||
size="16" | ||
class="-mt-0.5 align-middle inline-block text-slate-600 dark:text-slate-300" | ||
:icon="attachmentIcon" | ||
/> | ||
{{ $t(`${attachmentMessageContent}`) }} | ||
</span> | ||
<span v-else> | ||
{{ defaultEmptyMessage || $t('CHAT_LIST.NO_CONTENT') }} | ||
</span> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { MESSAGE_TYPE } from 'widget/helpers/constants'; | ||
import messageFormatterMixin from 'shared/mixins/messageFormatterMixin'; | ||
import { ATTACHMENT_ICONS } from 'shared/constants/messages'; | ||
export default { | ||
name: 'MessagePreview', | ||
mixins: [messageFormatterMixin], | ||
props: { | ||
message: { | ||
type: Object, | ||
required: true, | ||
}, | ||
showMessageType: { | ||
type: Boolean, | ||
default: true, | ||
}, | ||
defaultEmptyMessage: { | ||
type: String, | ||
default: '', | ||
}, | ||
}, | ||
computed: { | ||
messageByAgent() { | ||
const { message_type: messageType } = this.message; | ||
return messageType === MESSAGE_TYPE.OUTGOING; | ||
}, | ||
isMessageAnActivity() { | ||
const { message_type: messageType } = this.message; | ||
return messageType === MESSAGE_TYPE.ACTIVITY; | ||
}, | ||
isMessagePrivate() { | ||
const { private: isPrivate } = this.message; | ||
return isPrivate; | ||
}, | ||
parsedLastMessage() { | ||
const { content_attributes: contentAttributes } = this.message; | ||
const { email: { subject } = {} } = contentAttributes || {}; | ||
return this.getPlainText(subject || this.message.content); | ||
}, | ||
lastMessageFileType() { | ||
const [{ file_type: fileType } = {}] = this.message.attachments; | ||
return fileType; | ||
}, | ||
attachmentIcon() { | ||
return ATTACHMENT_ICONS[this.lastMessageFileType]; | ||
}, | ||
attachmentMessageContent() { | ||
return `CHAT_LIST.ATTACHMENTS.${this.lastMessageFileType}.CONTENT`; | ||
}, | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.