feat: Move timeMixin to a helper (#9799)

# Pull Request Template

## Description

This PR will replace the usage of `timeMixin` with `timeHelper`

Fixes
https://linear.app/chatwoot/issue/CW-3451/move-time-mixin-to-a-helper

## Type of change

- [x] New feature (non-breaking change which adds functionality)

## How Has This Been Tested?

Please refer to this issue description.
https://linear.app/chatwoot/issue/CW-3451/move-time-mixin-to-a-helper

## Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [x] I have commented on my code, particularly in hard-to-understand
areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream
modules

---------

Co-authored-by: Sojan Jose <sojan@pepalo.com>
This commit is contained in:
Sivin Varghese
2024-07-22 13:07:29 +05:30
committed by GitHub
parent 84c380c8c4
commit 79381b08cc
25 changed files with 305 additions and 314 deletions

View File

@@ -30,7 +30,7 @@
/>
<div
v-if="hasAttachments"
class="chat-bubble has-attachment space-y-2 agent"
class="space-y-2 chat-bubble has-attachment agent"
:class="(wrapClass, $dm('bg-white', 'dark:bg-slate-700'))"
>
<div
@@ -90,7 +90,7 @@
import UserMessage from 'widget/components/UserMessage.vue';
import AgentMessageBubble from 'widget/components/AgentMessageBubble.vue';
import MessageReplyButton from 'widget/components/MessageReplyButton.vue';
import timeMixin from 'dashboard/mixins/time';
import { messageStamp } from 'shared/helpers/timeHelper';
import ImageBubble from 'widget/components/ImageBubble.vue';
import VideoBubble from 'widget/components/VideoBubble.vue';
import FileBubble from 'widget/components/FileBubble.vue';
@@ -116,7 +116,7 @@ export default {
MessageReplyButton,
ReplyToChip,
},
mixins: [timeMixin, configMixin, messageMixin, darkModeMixin],
mixins: [configMixin, messageMixin, darkModeMixin],
props: {
message: {
type: Object,
@@ -146,7 +146,7 @@ export default {
},
readableTime() {
const { created_at: createdAt = '' } = this.message;
return this.messageStamp(createdAt, 'LLL d yyyy, h:mm a');
return messageStamp(createdAt, 'LLL d yyyy, h:mm a');
},
messageType() {
const { message_type: type = 1 } = this.message;

View File

@@ -83,7 +83,7 @@ import ImageBubble from 'widget/components/ImageBubble.vue';
import VideoBubble from 'widget/components/VideoBubble.vue';
import FluentIcon from 'shared/components/FluentIcon/Index.vue';
import FileBubble from 'widget/components/FileBubble.vue';
import timeMixin from 'dashboard/mixins/time';
import { messageStamp } from 'shared/helpers/timeHelper';
import messageMixin from '../mixins/messageMixin';
import ReplyToChip from 'widget/components/ReplyToChip.vue';
import DragWrapper from 'widget/components/DragWrapper.vue';
@@ -103,7 +103,7 @@ export default {
ReplyToChip,
DragWrapper,
},
mixins: [timeMixin, messageMixin],
mixins: [messageMixin],
props: {
message: {
type: Object,
@@ -135,7 +135,7 @@ export default {
},
readableTime() {
const { created_at: createdAt = '' } = this.message;
return this.messageStamp(createdAt);
return messageStamp(createdAt);
},
isFailed() {
const { status = '' } = this.message;