Skip to content

Commit c06f4d0

Browse files
committed
horizontal matches and fix matches not removed if messages existed
1 parent c3d8a95 commit c06f4d0

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

frontend/src/views/app/Matches.vue

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
<div class="mt-8 sm:mt-0">
88
<div v-if="matches.length">
99
<h1 class="text-xl md:text-base text-gray-matcha font-bold">Matches</h1>
10-
<div class="overflow-scroll mt-4">
11-
<Match v-on:chat="chat" v-for="match in matches" :key="match.id" v-bind:match="match"></Match>
10+
<div class="overflow-scroll flex mt-4">
11+
<Match v-bind:class="{'ml-2': index !== 0}" v-on:chat="chat" v-for="(match, index) in matches" :key="index" v-bind:match="match"></Match>
1212
</div>
1313
</div>
1414
<div v-else class="flex items-center">
@@ -24,7 +24,7 @@
2424
<div class="mt-8">
2525
<div v-if="messages.length">
2626
<h1 class="text-xl md:text-base text-gray-matcha text-left font-bold">Messages</h1>
27-
<div class="overflow-scroll mt-4">
27+
<div class="overflow-scroll md:h-64 mt-4">
2828
<Message v-on:chat="chat" v-for="message in messages" :key="message.with_user.id" v-bind:message="message"></Message>
2929
</div>
3030
</div>
@@ -103,11 +103,16 @@ export default {
103103
return;
104104
}
105105
for (let i = 0; i < matches.length; i += 1) {
106+
let matchHasMessage = false;
106107
for (let j = 0; j < this.messages.length; j += 1) {
107-
if (this.messages[j].with_user.id !== matches[i].user_1 && this.messages[j].with_user.id !== matches[i].user_2) {
108-
await this.fetchMatch(matches[i].user_1, matches[i].user_2);
108+
if (this.messages[j].with_user.id === matches[i].user_1 || this.messages[j].with_user.id === matches[i].user_2) {
109+
matchHasMessage = true;
110+
break;
109111
}
110112
}
113+
if (!matchHasMessage) {
114+
await this.fetchMatch(matches[i].user_1, matches[i].user_2);
115+
}
111116
}
112117
},
113118
async fetchMessages() {

0 commit comments

Comments
 (0)