6 th {{ st.tr["Variant"] }}
7 th {{ st.tr["White"] }}
8 th {{ st.tr["Black"] }}
9 th {{ st.tr["Cadence"] }}
10 th {{ st.tr["Result"] }}
12 tr(v-for="g in sortedGames" @click="$emit('show-game',g)"
13 :class="{'my-turn': g.myTurn}")
14 td(data-label="Variant") {{ g.vname }}
15 td(data-label="White") {{ g.players[0].name || "@nonymous" }}
16 td(data-label="Black") {{ g.players[1].name || "@nonymous" }}
17 td(data-label="Time control") {{ g.timeControl }}
18 td(data-label="Result") {{ g.score }}
22 import { store } from "@/store";
33 sortedGames: function() {
34 // Show in order: games where it's my turn, my running games, my games, other games
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 // I play in this game, so g.fen will be defined
48 if (!!g.fen.match(" " + myColor + " "))
52 return Object.assign({}, g, {priority: priority, myTurn: priority==3});
54 return augmentedGames.sort((g1,g2) => { return g2.priority - g1.priority; });
60 <style lang="sass" scoped>
61 // TODO: understand why the style applied to <tr> element doesn't work
63 background-color: #fcd785