8 th(v-if="showResult") Result
9 tr(v-for="g in sortedGames" @click="$emit('show-game',g)"
10 :class="{'my-turn': g.myTurn}")
12 td {{ g.players[0].name || "@nonymous" }}
13 td {{ g.players[1].name || "@nonymous" }}
14 td {{ g.timeControl }}
15 td(v-if="showResult") {{ g.score }}
19 import { store } from "@/store";
31 sortedGames: function() {
32 // Show in order: games where it's my turn, my running games, my games, other games
33 this.showResult = this.games.some(g => g.score != "*");
34 let augmentedGames = this.games.map(g => {
36 if (g.players.some(p => p.uid == this.st.user.id || p.sid == this.st.user.sid))
42 const myColor = g.players[0].uid == this.st.user.id
43 || g.players[0].sid == this.st.user.sid
46 if (!!g.fen.match(" " + myColor + " "))
50 return Object.assign({}, g, {priority: priority, myTurn: priority==2});
52 return augmentedGames.sort((g1,g2) => { return g2.priority - g1.priority; });
58 <style scoped lang="sass">
60 // TODO: the style doesn't work... why?
61 background-color: orange