22 <!-- eslint-disable max-len -->
33 <div class =" mx-4 sm:mx-16 lg:mx-32" >
44 <NavBar v-bind:currentRoute =" 'Matches'" ></NavBar >
5- <section class =" mx-auto" >
6- <div >
7- <div class =" mt-8" >
5+ <section v-if = " fetchingDone " class =" mx-auto relative md:flex md:items-start " >
6+ <div class = " md:w-full md:max-w-xs md:shadow-md md:rounded-md md:p-8 md:flex md:flex-col md:justify-start " >
7+ <div class =" mt-8 sm:mt-0 " >
88 <div v-if =" matches.length" >
9- <h1 class =" text-xl text-gray-matcha text-center font-bold" >New matches </h1 >
9+ <h1 class =" text-xl md: text-base text- gray-matcha font-bold" >Matches </h1 >
1010 <div class =" overflow-scroll mt-4" >
11- <Match v-for =" match in matches" :key =" match.id" v-bind:match =" match" ></Match >
11+ <Match v-on:chat = " chat " v- for =" match in matches" :key =" match.id" v-bind:match =" match" ></Match >
1212 </div >
1313 </div >
1414 <div v-else class =" flex items-center" >
1515 <div >
1616 <img src =" ../../assets/link.png" class =" w-8 opacity-75" >
1717 </div >
1818 <div class =" ml-4" >
19- <h1 class =" text-xl text-gray-matcha font-bold" >No new matches </h1 >
19+ <h1 class =" text-xl md: text-base text- gray-matcha font-bold" >Matches </h1 >
2020 <h1 class =" text-sm text-gray-500" >If someone likes you back, that user will appear here</h1 >
2121 </div >
2222 </div >
2323 </div >
2424 <div class =" mt-8" >
2525 <div v-if =" messages.length" >
26- <h1 class =" text-xl text-gray-matcha text-center font-bold" >Messages</h1 >
26+ <h1 class =" text-xl md:text-base text-gray-matcha text-center font-bold" >Messages</h1 >
2727 <div ></div >
2828 </div >
2929 <div v-else class =" flex items-center" >
3030 <div >
3131 <img src =" ../../assets/chat.png" class =" w-8 opacity-75" >
3232 </div >
3333 <div class =" ml-4" >
34- <h1 class =" text-xl text-gray-matcha font-bold" >No messages </h1 >
34+ <h1 class =" text-xl md: text-base text- gray-matcha font-bold" >Messages </h1 >
3535 <h1 class =" text-sm text-gray-500" >Conversations with your matches will appear here</h1 >
3636 </div >
3737 </div >
3838 </div >
3939 </div >
40+ <Chat class =" absolute top-0 w-full h-full bg-white-matcha
41+ md:relative md:ml-4"
42+ v-if =" chatWithUserId"
43+ v-bind:chatWithUserId =" chatWithUserId"
44+ v-on:close-chat =" closeChat()" ></Chat >
45+ <div v-if =" !chatWithUserId" class =" pl-8 w-full text-left max-w-2xl invisible md:visible md:relative md:ml-4" >
46+ <div v-if =" !matches.length && !messages.length" >
47+ <h1 class =" text-4xl text-gray-400 font-bold" >Use Browse, Search</h1 >
48+ <h1 class =" text-4xl text-gray-400 font-bold" >to like people</h1 >
49+ <h1 class =" text-4xl text-gray-400 font-bold" >and get matches</h1 >
50+ </div >
51+ <div v-if =" matches.length && !messages.length" >
52+ <h1 class =" text-5xl text-gray-400 font-bold" >Time to chat</h1 >
53+ <h1 class =" text-5xl text-gray-400 font-bold" >with your</h1 >
54+ <h1 class =" text-5xl text-gray-400 font-bold" >matches</h1 >
55+ </div >
56+ </div >
4057 </section >
4158 </div >
4259</template >
4764
4865import NavBar from ' @/components/shared/NavBar.vue' ;
4966import Match from ' @/components/app/matches/Match.vue' ;
67+ import Chat from ' @/components/app/matches/Chat.vue' ;
5068
5169export default {
5270 name: ' Matches' ,
5371 components: {
72+ Chat,
5473 NavBar,
5574 Match,
5675 },
5776 data : () => ({
5877 matches: [],
5978 messages: [],
79+ chatWithUserId: null ,
80+ fetchingDone: false ,
6081 }),
6182 methods: {
6283 async fetchMatches () {
@@ -76,10 +97,20 @@ export default {
7697 }
7798 this .messages = messages;
7899 },
100+ async chat (... args ) {
101+ const [id ] = args;
102+ if (id) {
103+ this .chatWithUserId = id;
104+ }
105+ },
106+ closeChat () {
107+ this .chatWithUserId = null ;
108+ },
79109 },
80110 async beforeMount () {
81111 await this .fetchMatches ();
82112 await this .fetchMessages ();
113+ this .fetchingDone = true ;
83114 },
84115};
85116 </script >
0 commit comments