Skip to content

Commit bcfe876

Browse files
committed
display match
1 parent cd178b9 commit bcfe876

File tree

2 files changed

+57
-3
lines changed

2 files changed

+57
-3
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<template>
2+
<div v-bind:style="{
3+
'background-repeat': 'no-repeat',
4+
'background-position': 'center center',
5+
'background-size' :'cover',
6+
'background-image': 'url(' + getImage() + ')'}"
7+
class="w-12 h-12 sm:w-16 sm:h-16 rounded-full relative cursor-pointer"
8+
v-on:click="chat()">
9+
<div
10+
v-bind:class="{
11+
'bg-green-500': this.match.is_online,
12+
'bg-red-500': !this.match.is_online,
13+
'rounded-full': true,
14+
'w-4': true,
15+
'h-4': true}">
16+
</div>
17+
</div>
18+
</template>
19+
20+
<script>
21+
/* eslint-disable no-else-return */
22+
import imageMan from '../../../assets/recommendations/avatars/man1.png';
23+
import imageWoman from '../../../assets/recommendations/avatars/woman1.png';
24+
import imageOther from '../../../assets/recommendations/avatars/other.png';
25+
26+
export default {
27+
props: ['match'],
28+
methods: {
29+
getImage() {
30+
const { images } = this.match;
31+
if (images.length) {
32+
for (let i = 0; i < images.length; i += 1) {
33+
if (images[i].is_primary) {
34+
return images[i].link;
35+
}
36+
}
37+
return images[0].link;
38+
} else if (this.match.gender === 'male') {
39+
return imageMan;
40+
} else if (this.match.gender === 'female') {
41+
return imageWoman;
42+
}
43+
return imageOther;
44+
},
45+
async chat() {
46+
await this.$router.push(`/chat/${this.match.id}`);
47+
},
48+
},
49+
};
50+
</script>

frontend/src/views/app/Matches.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
<div>
77
<div class="mt-8">
88
<div v-if="matches.length">
9-
<h1 class="text-xl text-gray-matcha text-center">New matches</h1>
10-
<div></div>
9+
<h1 class="text-xl text-gray-matcha text-center font-bold">New matches</h1>
10+
<div class="overflow-scroll mt-4">
11+
<Match v-for="match in matches" :key="match.id" v-bind:match="match"></Match>
12+
</div>
1113
</div>
1214
<div v-else class="flex items-center">
1315
<div>
@@ -21,7 +23,7 @@
2123
</div>
2224
<div class="mt-8">
2325
<div v-if="messages.length">
24-
<h1 class="text-xl text-gray-matcha text-center">Messages</h1>
26+
<h1 class="text-xl text-gray-matcha text-center font-bold">Messages</h1>
2527
<div></div>
2628
</div>
2729
<div v-else class="flex items-center">
@@ -44,11 +46,13 @@
4446
/* eslint-disable no-await-in-loop */
4547
4648
import NavBar from '@/components/shared/NavBar.vue';
49+
import Match from '@/components/app/matches/Match.vue';
4750
4851
export default {
4952
name: 'Matches',
5053
components: {
5154
NavBar,
55+
Match,
5256
},
5357
data: () => ({
5458
matches: [],

0 commit comments

Comments
 (0)