Add date seprator in conversation
This commit is contained in:
parent
30920ae2e8
commit
0c68403cf0
2 changed files with 32 additions and 8 deletions
|
@ -40,12 +40,17 @@
|
||||||
<span v-if="shouldShowSpinner" class="spinner message" />
|
<span v-if="shouldShowSpinner" class="spinner message" />
|
||||||
</li>
|
</li>
|
||||||
</transition>
|
</transition>
|
||||||
<message
|
|
||||||
v-for="message in getReadMessages"
|
<template v-for="item in getGroupedMessages">
|
||||||
:key="message.id"
|
<date-separator :key="item.date" :date="item.date"></date-separator>
|
||||||
:data="message"
|
<message
|
||||||
:is-a-tweet="isATweet"
|
v-for="message in item.messages"
|
||||||
/>
|
:key="message.id"
|
||||||
|
:data="message"
|
||||||
|
:is-a-tweet="isATweet"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
<li v-show="getUnreadCount != 0" class="unread--toast">
|
<li v-show="getUnreadCount != 0" class="unread--toast">
|
||||||
<span class="text-uppercase">
|
<span class="text-uppercase">
|
||||||
{{ getUnreadCount }}
|
{{ getUnreadCount }}
|
||||||
|
@ -90,7 +95,11 @@ import ConversationHeader from './ConversationHeader';
|
||||||
import ReplyBox from './ReplyBox';
|
import ReplyBox from './ReplyBox';
|
||||||
import Message from './Message';
|
import Message from './Message';
|
||||||
import conversationMixin from '../../../mixins/conversations';
|
import conversationMixin from '../../../mixins/conversations';
|
||||||
import { getTypingUsersText } from '../../../helper/commons';
|
import {
|
||||||
|
getTypingUsersText,
|
||||||
|
getGroupedConversation,
|
||||||
|
} from '../../../helper/commons';
|
||||||
|
import DateSeparator from 'shared/components/DateSeparator.vue';
|
||||||
import { BUS_EVENTS } from 'shared/constants/busEvents';
|
import { BUS_EVENTS } from 'shared/constants/busEvents';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -98,6 +107,7 @@ export default {
|
||||||
ConversationHeader,
|
ConversationHeader,
|
||||||
Message,
|
Message,
|
||||||
ReplyBox,
|
ReplyBox,
|
||||||
|
DateSeparator,
|
||||||
},
|
},
|
||||||
|
|
||||||
mixins: [conversationMixin],
|
mixins: [conversationMixin],
|
||||||
|
@ -159,12 +169,23 @@ export default {
|
||||||
);
|
);
|
||||||
return chat;
|
return chat;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getGroupedMessages() {
|
||||||
|
const chat = this.getMessages;
|
||||||
|
const conversations = this.readMessages(chat);
|
||||||
|
const groupedConversationList = getGroupedConversation({
|
||||||
|
conversations,
|
||||||
|
});
|
||||||
|
return chat === undefined ? null : groupedConversationList;
|
||||||
|
},
|
||||||
|
|
||||||
getReadMessages() {
|
getReadMessages() {
|
||||||
const chat = this.getMessages;
|
const chat = this.getMessages;
|
||||||
return chat === undefined ? null : this.readMessages(chat);
|
return chat === undefined ? null : this.readMessages(chat);
|
||||||
},
|
},
|
||||||
getUnReadMessages() {
|
getUnReadMessages() {
|
||||||
const chat = this.getMessages;
|
const chat = this.getMessages;
|
||||||
|
|
||||||
return chat === undefined ? null : this.unReadMessages(chat);
|
return chat === undefined ? null : this.unReadMessages(chat);
|
||||||
},
|
},
|
||||||
shouldShowSpinner() {
|
shouldShowSpinner() {
|
||||||
|
@ -288,6 +309,10 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
::v-deep .date--separator {
|
||||||
|
margin: 0 1.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
.banner {
|
.banner {
|
||||||
background: var(--b-500);
|
background: var(--b-500);
|
||||||
color: var(--white);
|
color: var(--white);
|
||||||
|
|
|
@ -35,7 +35,6 @@ export default {
|
||||||
line-height: 50px;
|
line-height: 50px;
|
||||||
position: relative;
|
position: relative;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 100%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.date--separator::before,
|
.date--separator::before,
|
||||||
|
|
Loading…
Reference in a new issue