lots of changes to switch to vue

This commit is contained in:
Zutatensuppe 2021-05-13 22:45:55 +02:00
parent 5adb8806dc
commit a0118b0bdf
22 changed files with 582 additions and 920 deletions

View file

@ -0,0 +1,41 @@
"use strict"
// ingame component
// shows player scores
export default {
name: "scores",
template: `
<div class="scores">
<div>Scores</div>
<table>
<tr v-for="(p, idx) in actives" :key="idx" :style="{color: p.color}">
<td></td>
<td>{{p.name}}</td>
<td>{{p.points}}</td>
</tr>
<tr v-for="(p, idx) in idles" :key="idx" :style="{color: p.color}">
<td>💤</td>
<td>{{p.name}}</td>
<td>{{p.points}}</td>
</tr>
</table>
</div>
`,
computed: {
actives () {
// TODO: dont sort in place
this.activePlayers.sort((a, b) => b.points - a.points)
return this.activePlayers
},
idles () {
// TODO: dont sort in place
this.idlePlayers.sort((a, b) => b.points - a.points)
return this.idlePlayers
},
},
props: {
activePlayers: Array,
idlePlayers: Array,
},
}