<template lang="pug">
table
tr
- th(v-if="showVariant") Variant
+ th Variant
th From
th To
th Cadence
- th(v-if="showNbPlayers") Number of players
tr(v-for="c in challenges" @click="$emit('click-challenge',c)")
- td(v-if="showVariant") {{ c.variant }}
+ td {{ c.vname }}
td {{ c.from.name }}
- td
- span(v-for="p in c.to") {{ p.name }}
- td {{ c.mainTime }} + {{ c.increment }}
- td(v-if="showNbPlayers") {{ c.nbPlayers }}
+ td(v-if="!!c.to[0]")
+ span(v-for="pname in c.to") {{ pname }}
+ td(v-else) {{ c.to.length - 1 }} player{{ c.to.length >= 3 ? 's' : '' }}
+ td {{ c.timeControl }}
</template>
<script>
export default {
name: "my-challenge-list",
props: ["challenges"],
- computed: {
- showVariant: function() {
- this.challenges.length > 0 && !!this.challenges[0].variant;
- },
- showNbPlayers: function() {
- this.challenges.length > 0 && !!this.challenges[0].nbPlayers;
- },
- },
};
-// TODO: challenge format from/to ou uid/players ............
</script>
<style lang="sass">