tbody
tr(v-for="c in sortedChallenges" @click="$emit('click-challenge',c)")
td(data-label="Variant") {{ c.vname }}
- td(data-label="From") {{ c.from.name }}
+ td(data-label="From") {{ c.from.name || "@nonymous" }}
td(data-label="To") {{ c.to }}
td(data-label="Cadence") {{ c.timeControl }}
</template>
th {{ st.tr["White"] }}
th {{ st.tr["Black"] }}
th {{ st.tr["Time control"] }}
- th(v-if="showResult") Result
+ th {{ st.tr["Result"] }}
tbody
tr(v-for="g in sortedGames" @click="$emit('show-game',g)"
:class="{'my-turn': g.myTurn}")
td(data-label="White") {{ g.players[0].name || "@nonymous" }}
td(data-label="Black") {{ g.players[1].name || "@nonymous" }}
td(data-label="Time control") {{ g.timeControl }}
- td(v-if="showResult" data-label="Result") {{ g.score }}
+ td(data-label="Result") {{ g.score }}
</template>
<script>
data: function() {
return {
st: store.state,
- showResult: false,
};
},
computed: {
sortedGames: function() {
// Show in order: games where it's my turn, my running games, my games, other games
- this.showResult = this.games.some(g => g.score != "*");
let augmentedGames = this.games.map(g => {
let priority = 0;
if (g.players.some(p => p.uid == this.st.user.id || p.sid == this.st.user.sid))
"Registration complete! Please check your emails": "Registration complete! Please check your emails",
"Resign": "Resign",
"Resign the game?": "Resign the game?",
+ "Result": "Result",
"Rules": "Rules",
"Sample game": "Sample game",
"Send": "Send",
players: this.game.players,
vid: this.game.vid,
timeControl: this.game.timeControl,
+ score: this.game.score,
};
this.st.conn.send(JSON.stringify({code:"game",
game:myGame, target:data.from}));
newGame.type = this.classifyObject(data.game);
newGame.vname = this.getVname(data.game.vid);
newGame.rid = data.from;
- newGame.score = "*";
this.games.push(newGame);
}
break;
this.st.conn.send(JSON.stringify({code:"askgame", target:data.from}));
break;
case "disconnect":
- case "pdisconnect":
+ case "gdisconnect":
this.$delete(this.people, data.from);
if (data.code == "disconnect")
{
});
break;
}
+ case "askgame":
+ clients[obj.target].sock.send(JSON.stringify(
+ {code:"askgame", from:sid}));
+ break;
case "askfullgame":
clients[obj.target].sock.send(JSON.stringify(
{code:"askfullgame", from:sid}));
notifyRoom(clients[sid].page, "newchat", {chat:obj.chat});
break;
// TODO: WebRTC instead in this case (most demanding?)
- // --> At least do a "notifyRoom"
+ // --> Or else: at least do a "notifyRoom" (also for draw, resign...)
case "newmove":
clients[obj.target].sock.send(JSON.stringify(
{code:"newmove", move:obj.move}));