X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FGame.vue;h=e77492f0da0d212d04cd6bac2c4422341cdca0ed;hb=ed06d9e92387e60fc15d7c9768dd5680605e35d1;hp=c0c50318a7d536e10c7d1db9d84f8a42ca5a2fe3;hpb=4f51861013271a060b358884097a676e3d42d496;p=vchess.git diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index c0c50318..e77492f0 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -5,6 +5,12 @@ main aria-labelledby="inputChat") #chat.card label.modal-close(for="modalChat") + #participants + span {{ Object.keys(people).length }} participant(s): + span(v-for="p in Object.values(people)" v-if="!!p.name") + | {{ p.name }} + span.anonymous(v-if="Object.values(people).some(p => !p.name)") + | + @nonymous Chat(:players="game.players" :pastChats="game.chats" @newchat-sent="finishSendChat" @newchat-received="processChat") .row @@ -16,10 +22,12 @@ main button(@click="resign") Resign #playersInfo p - span.name(:class="{connected: isConnected(0)}") {{ game.players[0].name }} + span.name(:class="{connected: isConnected(0)}") + | {{ game.players[0].name || "@nonymous" }} span.time(v-if="game.score=='*'") {{ virtualClocks[0] }} span.split-names - - span.name(:class="{connected: isConnected(1)}") {{ game.players[1].name }} + span.name(:class="{connected: isConnected(1)}") + | {{ game.players[1].name || "@nonymous" }} span.time(v-if="game.score=='*'") {{ virtualClocks[1] }} BaseGame(:game="game" :vr="vr" ref="basegame" @newmove="processMove" @gameover="gameOver") @@ -157,8 +165,6 @@ export default { case "pollclients": { data.sockIds.forEach(sid => { - // TODO: understand clearly what happens here, problems when a - // game is quit, and then launch a new game from hall. if (!!this.people[sid]) return; this.$set(this.people, sid, {id:0, name:""}); @@ -214,7 +220,9 @@ export default { break; } case "askgame": - // Send current (live) game + // Send current (live) game if not asked by opponent (!) + if (this.game.players.some(p => p.sid == data.from)) + return; const myGame = { // Minimal game informations: @@ -548,7 +556,11 @@ export default { this.drawOffer = "threerep"; }, toggleChat: function() { - document.getElementById("chatBtn").style.backgroundColor = "#e2e2e2"; + let modalChat = document.getElementById("modalChat"); + modalChat.style.backgroundColor = + (modalChat.style.backgroundColor == "#e2e2e2" + ? "#c5fefe" + : "#e2e2e2"); }, finishSendChat: function(chat) { // NOTE: anonymous chats in corr games are not stored on server (TODO?) @@ -556,7 +568,7 @@ export default { GameStorage.update(this.gameRef.id, {chat: chat}); }, processChat: function() { - if (!document.getElementById("inputChat").checked) + if (!document.getElementById("modalChat").checked) document.getElementById("chatBtn").style.backgroundColor = "#c5fefe"; }, gameOver: function(score, scoreMsg) { @@ -579,6 +591,13 @@ export default { .connected background-color: lightgreen +#participants + margin-left: 5px + +.anonymous + color: grey + font-style: italic + @media screen and (min-width: 768px) #actions width: 300px