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