2021-05-17 00:27:47 +02:00
|
|
|
<template>
|
2021-05-13 22:45:55 +02:00
|
|
|
<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>
|
2021-05-17 00:27:47 +02:00
|
|
|
</template>
|
|
|
|
|
<script lang="ts">
|
|
|
|
|
import { defineComponent } from 'vue'
|
|
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
|
name: "scores",
|
|
|
|
|
props: {
|
|
|
|
|
activePlayers: {
|
|
|
|
|
type: Array,
|
|
|
|
|
required: true,
|
|
|
|
|
},
|
|
|
|
|
idlePlayers: {
|
|
|
|
|
type: Array,
|
|
|
|
|
required: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
2021-05-13 22:45:55 +02:00
|
|
|
computed: {
|
2021-05-17 00:27:47 +02:00
|
|
|
actives (): Array<any> {
|
2021-05-13 22:45:55 +02:00
|
|
|
// TODO: dont sort in place
|
2021-05-17 00:27:47 +02:00
|
|
|
this.activePlayers.sort((a: any, b: any) => b.points - a.points)
|
2021-05-13 22:45:55 +02:00
|
|
|
return this.activePlayers
|
|
|
|
|
},
|
2021-05-17 00:27:47 +02:00
|
|
|
idles (): Array<any> {
|
2021-05-13 22:45:55 +02:00
|
|
|
// TODO: dont sort in place
|
2021-05-17 00:27:47 +02:00
|
|
|
this.idlePlayers.sort((a: any, b: any) => b.points - a.points)
|
2021-05-13 22:45:55 +02:00
|
|
|
return this.idlePlayers
|
|
|
|
|
},
|
|
|
|
|
},
|
2021-05-17 00:27:47 +02:00
|
|
|
})
|
|
|
|
|
</script>
|