Saving current state
[vchess.git] / client / src / components / ChallengeList.vue
index a52e0ca..8951226 100644 (file)
@@ -1,34 +1,24 @@
 <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
+    td(v-if="c.to[0].id > 0")
       span(v-for="p in c.to") {{ p.name }}
-      td {{ c.mainTime }} + {{ c.increment }}
-      td(v-if="showNbPlayers") {{ c.nbPlayers }}
+    td(v-else) {{ c.nbPlayers - 1 }} player{{ c.nbPlayers >= 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">