Skip to content

Commit fda61c5

Browse files
committed
add purple circle chatbox on new message
1 parent 764892b commit fda61c5

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

frontend/src/components/app/matches/Chat.vue

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,9 @@
22
<!-- eslint-disable max-len -->
33
<div class="chat md:w-full md:max-w-2xl md:shadow-md md:rounded-md md:p-4 md:flex md:flex-col md:justify-start">
44
<div class="flex items-center justify-center">
5-
<div v-if="user" class="text-center flex">
6-
<div class="flex-row">
7-
<ChatUser class="mx-auto" v-bind:match="user"></ChatUser>
8-
<h1 class="text-gray-matcha opacity-75 text-sm">{{user.first_name}}</h1>
9-
</div>
10-
<div v-if="newMessageCount" class="ml-4 flex items-center justify-center">
11-
<h1 class="text-purple-matcha text-sm font-bold">{{newMessageCount}}</h1>
12-
</div>
5+
<div v-if="user" class="text-center flex-row">
6+
<ChatUser class="mx-auto" v-bind:match="user" v-bind:newmessage="newMessage"></ChatUser>
7+
<h1 class="text-gray-matcha opacity-75 text-sm">{{user.first_name}}</h1>
138
</div>
149
<div class="md:hidden absolute right-0 cursor-pointer text-lg lg:text-2xl w-10 h-10 flex items-center justify-center"
1510
v-on:click="closeChat()">
@@ -63,7 +58,7 @@ export default {
6358
user: null,
6459
message: '',
6560
loggedInUserId: null,
66-
newMessageCount: null,
61+
newMessage: false,
6762
fetchMessagesIntervalId: null,
6863
}),
6964
methods: {
@@ -97,7 +92,10 @@ export default {
9792
for (let i = this.messages.length; i < newMessages.length; i += 1) {
9893
this.messages.push(newMessages[i]);
9994
}
100-
this.scrollChatToBottom();
95+
this.newMessage = true;
96+
setTimeout(() => {
97+
this.newMessage = false;
98+
}, 2000);
10199
}
102100
},
103101
},

frontend/src/components/app/matches/ChatUser.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<template>
2+
<!-- eslint-disable max-len -->
23
<div v-bind:style="{
34
'background-repeat': 'no-repeat',
45
'background-position': 'center center',
@@ -14,6 +15,8 @@
1415
'w-3': true,
1516
'h-3': true}">
1617
</div>
18+
<div v-if="newmessage" class="bg-purple-matcha absolute right-0 bottom-0 w-4 h-4 rounded-full">
19+
</div>
1720
</div>
1821
</template>
1922

@@ -24,7 +27,7 @@ import imageWoman from '../../../assets/recommendations/avatars/woman1.png';
2427
import imageOther from '../../../assets/recommendations/avatars/other.png';
2528
2629
export default {
27-
props: ['match'],
30+
props: ['match', 'newmessage'],
2831
methods: {
2932
getImage() {
3033
const { images } = this.match;

0 commit comments

Comments
 (0)