From: Benjamin Auder <benjamin.auder@somewhere>
Date: Tue, 18 Feb 2020 20:32:50 +0000 (+0100)
Subject: Better challenge display: 'with' instead of 'from'
X-Git-Url: https://git.auder.net/doc/html/scripts/%7B%7B%20asset%28%27mixstore/images/%3C?a=commitdiff_plain;h=303ad63c7d3ff6566fd0d4523e5970acfbfdd933;p=vchess.git

Better challenge display: 'with' instead of 'from'
---

diff --git a/client/src/components/ChallengeList.vue b/client/src/components/ChallengeList.vue
index ed490671..a350c705 100644
--- a/client/src/components/ChallengeList.vue
+++ b/client/src/components/ChallengeList.vue
@@ -4,7 +4,7 @@ div
     thead
       tr
         th {{ st.tr["Variant"] }}
-        th {{ st.tr["From"] }}
+        th {{ st.tr["With"] }}
         th {{ st.tr["Cadence"] }}
     tbody
       tr(
@@ -13,7 +13,7 @@ div
         @click="$emit('click-challenge',c)"
       )
         td {{ c.vname }}
-        td {{ c.from.name || "@nonymous" }}
+        td {{ withWho(c) }}
         td {{ c.cadence }}
 </template>
 
@@ -46,6 +46,13 @@ export default {
         return c2.priority - c1.priority + (c2.added - c1.added) / deltaAdded;
       });
     }
+  },
+  methods: {
+    withWho: function(c) {
+      if (c.from.sid == this.st.user.sid || c.from.id == this.st.user.id)
+        return c.to || this.st.tr["Any player"];
+      return c.from.name || "@nonymous";
+    }
   }
 };
 </script>
diff --git a/client/src/translations/en.js b/client/src/translations/en.js
index 7fd40fc5..4e69ddcd 100644
--- a/client/src/translations/en.js
+++ b/client/src/translations/en.js
@@ -6,6 +6,7 @@ export const translations = {
   Analyse: "Analyse",
   "Analyse in Dark mode makes no sense!":
     "Analyse in Dark mode makes no sense!",
+  "Any player": "Any player",
   "Are you sure?": "Are you sure?",
   "Authentication successful!": "Authentication successful!",
   Apply: "Apply",
@@ -36,7 +37,6 @@ export const translations = {
   "Empty message": "Empty message",
   "Error while loading database:": "Error while loading database:",
   "Example game": "Example game",
-  From: "From",
   "Game retrieval failed:": "Game retrieval failed:",
   "Game removal failed:": "Game removal failed:",
   Go: "Go",
@@ -114,6 +114,7 @@ export const translations = {
   "White to move": "White to move",
   "White win": "White win",
   "Who's there?": "Who's there?",
+  With: "With",
   "Write news": "Write news",
   "Your message": "Your message",
 
diff --git a/client/src/translations/es.js b/client/src/translations/es.js
index 44203b9a..828f42a4 100644
--- a/client/src/translations/es.js
+++ b/client/src/translations/es.js
@@ -6,6 +6,7 @@ export const translations = {
   Analyse: "Analizar",
   "Analyse in Dark mode makes no sense!":
     "¡Analizar en modo Dark no tiene sentido!",
+  "Any player": "Cualquier jugador",
   Apply: "Aplicar",
   "Are you sure?": "¿Está usted seguro?",
   "Authentication successful!": "¡Autenticación exitosa!",
@@ -37,7 +38,6 @@ export const translations = {
   "Empty message": "Mensaje vacio",
   "Error while loading database:": "Error al cargar la base de datos:",
   "Example game": "Ejemplo de partida",
-  From: "De",
   "Game retrieval failed:": "La recuperación de la partida falló:",
   "Game removal failed:": "La eliminación de la partida falló:",
   Go: "Go",
@@ -116,6 +116,7 @@ export const translations = {
   "White to move": "Juegan las blancas",
   "White win": "Las blancas gagnan",
   "Who's there?": "¿Quién está ahí?",
+  With: "Con",
   "Write news": "Escribir una news",
   "Your message": "Tu mensaje",
 
diff --git a/client/src/translations/fr.js b/client/src/translations/fr.js
index d0877147..b67e7f7b 100644
--- a/client/src/translations/fr.js
+++ b/client/src/translations/fr.js
@@ -6,6 +6,7 @@ export const translations = {
   Analyse: "Analyser",
   "Analyse in Dark mode makes no sense!":
     "Analyser en mode Dark n'a pas de sens !",
+  "Any player": "N'importe qui",
   Apply: "Appliquer",
   "Authentication successful!": "Authentification réussie !",
   "Are you sure?": "Étes vous sûr?",
@@ -39,7 +40,6 @@ export const translations = {
   "Error while loading database:":
     "Erreur lors du chargement de la base de données :",
   "Example game": "Partie exemple",
-  From: "De",
   "Game retrieval failed:": "Échec de la récupération de la partie :",
   "Game removal failed:": "Échec de la suppresion de la partie :",
   Go: "Go",
@@ -119,6 +119,7 @@ export const translations = {
   "White to move": "Trait aux blancs",
   "White win": "Les blancs gagnent",
   "Who's there?": "Qui est là ?",
+  With: "Avec",
   "Write news": "Écrire une news",
   "Your message": "Votre message",