Skip to content

Commit b39caef

Browse files
committed
empty matches & messages screen
1 parent cf47b33 commit b39caef

File tree

4 files changed

+77
-2
lines changed

4 files changed

+77
-2
lines changed

frontend/src/assets/chat.png

16.9 KB
Loading

frontend/src/assets/link.png

20.3 KB
Loading

frontend/src/components/shared/NavBar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</div>
2828
<router-link v-if="loggedIn" to="/browse" v-bind:class="{'navigation-button-logged-in': true, 'bg-purple-matcha': currentRoute === 'Browse', 'text-white-matcha': currentRoute === 'Browse'}">Browse</router-link>
2929
<router-link v-if="loggedIn" to="/search" v-bind:class="{'navigation-button-logged-in': true, 'bg-purple-matcha': currentRoute === 'Search', 'text-white-matcha': currentRoute === 'Search'}">Search</router-link>
30-
<router-link v-if="loggedIn" to="/matches" v-bind:class="{'navigation-button-logged-in': true, 'bg-purple-matcha': currentRoute === 'Matches', 'text-white-matcha': currentRoute === 'Matches'}" class="navigation-button-logged-in">Matches</router-link>
30+
<router-link v-if="loggedIn" to="/matches" v-bind:class="{'navigation-button-logged-in': true, 'bg-purple-matcha': currentRoute === 'Matches', 'text-white-matcha': currentRoute === 'Matches'}">Matches</router-link>
3131
<router-link v-if="loggedIn" to="/settings" v-bind:class="{'navigation-button-logged-in': true, 'bg-purple-matcha': currentRoute === 'Settings', 'text-white-matcha': currentRoute === 'Settings'}">Settings</router-link>
3232
<router-link v-if="loggedIn" to="/history" v-bind:class="{'navigation-button-logged-in': true, 'bg-purple-matcha': currentRoute === 'History', 'text-white-matcha': currentRoute === 'History'}">History</router-link>
3333
<router-link v-if="loggedIn" v-on:click.native="logout()" to="/" class="navigation-button-logged-in">Exit</router-link>

frontend/src/views/app/Matches.vue

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,81 @@
11
<template>
2-
<h1>test</h1>
2+
<!-- eslint-disable max-len -->
3+
<div class="mx-4 sm:mx-16 lg:mx-32">
4+
<NavBar v-bind:currentRoute="'Matches'"></NavBar>
5+
<section class="mx-auto">
6+
<div>
7+
<div class="mt-8">
8+
<div v-if="matches.length">
9+
<h1 class="text-xl text-gray-matcha text-center">New matches</h1>
10+
<div></div>
11+
</div>
12+
<div v-else class="flex items-center">
13+
<div>
14+
<img src="../../assets/link.png" class="w-8 opacity-75">
15+
</div>
16+
<div class="ml-4">
17+
<h1 class="text-xl text-gray-matcha font-bold">No new matches</h1>
18+
<h1 class="text-sm text-gray-500">If someone likes you back, that user will appear here</h1>
19+
</div>
20+
</div>
21+
</div>
22+
<div class="mt-8">
23+
<div v-if="messages.length">
24+
<h1 class="text-xl text-gray-matcha text-center">Messages</h1>
25+
<div></div>
26+
</div>
27+
<div v-else class="flex items-center">
28+
<div>
29+
<img src="../../assets/chat.png" class="w-8 opacity-75">
30+
</div>
31+
<div class="ml-4">
32+
<h1 class="text-xl text-gray-matcha font-bold">No messages</h1>
33+
<h1 class="text-sm text-gray-500">Conversations with your matches will appear here</h1>
34+
</div>
35+
</div>
36+
</div>
37+
</div>
38+
</section>
39+
</div>
340
</template>
441

542
<script>
43+
/* eslint-disable max-len */
44+
/* eslint-disable no-await-in-loop */
45+
46+
import NavBar from '@/components/shared/NavBar.vue';
47+
48+
export default {
49+
name: 'Matches',
50+
components: {
51+
NavBar,
52+
},
53+
data: () => ({
54+
matches: [],
55+
messages: [],
56+
}),
57+
methods: {
58+
async fetchMatches() {
59+
const matchesRequest = await this.$http.get('/matches');
60+
const { matches } = matchesRequest.data;
61+
for (let i = 0; i < matches.length; i += 1) {
62+
const userRequest = await this.$http.get(`/users/${matches[i].user_1}`);
63+
this.matches.push(userRequest.data);
64+
}
65+
},
66+
async fetchMessages() {
67+
const messagesRequest = await this.$http.get('/conversations');
68+
const messages = messagesRequest.data;
69+
for (let i = 0; i <= messages.length; i += 1) {
70+
const userChattingWith = await this.$http.get(`/users/${messages[i].with_user}`);
71+
messages[i].user = userChattingWith.data;
72+
}
73+
this.messages = messages;
74+
},
75+
},
76+
async beforeMount() {
77+
await this.fetchMatches();
78+
await this.fetchMessages();
79+
},
80+
};
681
</script>

0 commit comments

Comments
 (0)