From: Benjamin Auder Date: Sun, 9 Feb 2020 01:07:30 +0000 (+0100) Subject: Fixes X-Git-Url: https://git.auder.net/doc/html/css/img/current/pieces/common.css?a=commitdiff_plain;h=29ced362f46ae68e4314985bf836b3adeba23f32;p=vchess.git Fixes --- diff --git a/client/src/translations/en.js b/client/src/translations/en.js index bb5f39fa..ae1101df 100644 --- a/client/src/translations/en.js +++ b/client/src/translations/en.js @@ -60,6 +60,7 @@ export const translations = "Play with?": "Play with?", "Playing": "Playing", "Please log in to accept corr challenges": "Please log in to accept corr challenges", + "Please log in to play correspondance games": "Please log in to play correspondance games", "Please select a variant": "Please select a variant", "Practice": "Practice", "Processing... Please wait": "Processing... Please wait", diff --git a/client/src/translations/es.js b/client/src/translations/es.js index 0b1830d3..0e9724b8 100644 --- a/client/src/translations/es.js +++ b/client/src/translations/es.js @@ -60,6 +60,7 @@ export const translations = "Play with?": "¿ Jugar con ?", "Playing": "Jugando", "Please log in to accept corr challenges": "Inicia sesión para aceptar los desafíos por correspondencia", + "Please log in to play correspondance games": "Inicia sesión para jugar partidas por correspondancia", "Please select a variant": "Por favor seleccione una variante", "Practice": "Práctica", "Processing... Please wait": "Procesando... por favor espere", diff --git a/client/src/translations/fr.js b/client/src/translations/fr.js index 54e316c1..15673519 100644 --- a/client/src/translations/fr.js +++ b/client/src/translations/fr.js @@ -60,6 +60,7 @@ export const translations = "Play with?": "Jouer avec ?", "Playing": "Jouant", "Please log in to accept corr challenges": "Identifiez vous pour accepter des défis par correspondance", + "Please log in to play correspondance games": "Identifiez vous pour jouer des parties par correspondance", "Please select a variant": "Sélectionnez une variante SVP", "Practice": "Pratiquer", "Processing... Please wait": "Traitement en cours... Attendez SVP", diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index baa9ae19..0072bd43 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -152,10 +152,13 @@ export default { this.st.conn.send(JSON.stringify({code:"pollclients"})); }, isConnected: function(index) { - const name = this.game.players[index].name; - if (this.st.user.name == name) + const player = this.game.players[index]; + // Is it me ? + if (this.st.user.sid == player.sid || this.st.user.id == player.uid) return true; - return Object.values(this.people).some(p => p.name == name); + // Try to find a match in people: + return Object.keys(this.people).some(sid => sid == player.sid) || + Object.values(this.people).some(p => p.id == player.uid); }, socketMessageListener: function(msg) { const data = JSON.parse(msg.data); diff --git a/client/src/views/Hall.vue b/client/src/views/Hall.vue index fbd5e286..bbff9b95 100644 --- a/client/src/views/Hall.vue +++ b/client/src/views/Hall.vue @@ -509,17 +509,18 @@ export default { this.newchallenge.to = this.people[sid].name; doClick("modalNewgame"); }, - challOrWatch: function(sid, e) { - switch (e.target.innerHTML) + challOrWatch: function(sid) { + if (!this.people[sid].gamer) { - case "Available": - this.tryChallenge(sid); - break; - case "Playing": - this.showGame(this.games.find( - g => g.players.some(pl => pl.sid == sid || pl.uid == this.people[sid].id))); - break; - }; + // Available, in Hall + this.tryChallenge(sid); + } + else + { + // Playing, in Game + this.showGame(this.games.find( + g => g.players.some(pl => pl.sid == sid || pl.uid == this.people[sid].id))); + } }, newChallenge: async function() { if (this.newchallenge.vid == "")