Skip to content

Commit

Permalink
Swipe right support
Browse files Browse the repository at this point in the history
  • Loading branch information
vince0656 committed Nov 26, 2019
1 parent 3bd68b1 commit 5657010
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/components/Chat.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="hello">
<h1>Crypto Kitties Poke</h1>
<h1>Crypto Kitties Tinder🔥</h1>
<small v-if="accounts.user">Your account: {{accounts.user}}</small>
<div v-if="kitties.user && kitties.user.length">
<small>Your kitties:</small>
Expand All @@ -22,7 +22,7 @@
<small>Found kitties:</small>
<ul>
<li v-for="(kittie, idx) in kitties.other" :key="idx">
<small>{{kittie}}</small> - <button @click="poke(kittie)">Poke</button>
<small>{{kittie}}</small> - <button @click="poke(kittie)">Poke</button> - <button @click="swipeRight(kittie)">Swipe Right🔥</button>
</li>
</ul>
</div>
Expand Down Expand Up @@ -70,16 +70,27 @@
},
poke: function (kittieId) {
const uuid = this.$uuid;
console.log('hi')
const pokeId = uuid.v4();
db.collection('kitties').doc('network').collection('mainnet').doc(kittieId)
.collection('poke')
.doc(pokeId)
.set({msg: 'Hello treakle, want to tinder?'}, {
.set({msg: 'Hello treakle, want to tinder?', from: this.accounts.user, stud: this.kitties.user[0]}, {
merge: true
});
console.log(`poke [[${pokeId}]] to kittie ${kittieId}`);
},
swipeRight: function (kittieId) {
const uuid = this.$uuid;
const swipeId = uuid.v4();
const stud = this.kitties.user[0];
db.collection('kitties').doc('network').collection('mainnet').doc(kittieId)
.collection('swipeRight')
.doc(swipeId)
.set({msg: `Hello treakle, want to breed with ${stud}?`, from: this.accounts.user, stud}, {
merge: true
});
console.log(`swipe [[${swipeId}]] to kittie ${kittieId}`);
},
find: async function() {
this.kitties.other = await this.getKittiesForAddressFromDB('mainnet', this.accounts.other);
},
Expand Down

0 comments on commit 5657010

Please sign in to comment.