projects
/
vchess.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a0c41e7
)
Fix passing games
author
Benjamin Auder
<benjamin.auder@somewhere>
Fri, 7 Feb 2020 10:24:29 +0000
(11:24 +0100)
committer
Benjamin Auder
<benjamin.auder@somewhere>
Fri, 7 Feb 2020 10:24:29 +0000
(11:24 +0100)
client/src/components/ChallengeList.vue
patch
|
blob
|
blame
|
history
client/src/components/GameList.vue
patch
|
blob
|
blame
|
history
client/src/translations/en.js
patch
|
blob
|
blame
|
history
client/src/views/Game.vue
patch
|
blob
|
blame
|
history
client/src/views/Hall.vue
patch
|
blob
|
blame
|
history
server/sockets.js
patch
|
blob
|
blame
|
history
diff --git
a/client/src/components/ChallengeList.vue
b/client/src/components/ChallengeList.vue
index
095c096
..
fd2a901
100644
(file)
--- a/
client/src/components/ChallengeList.vue
+++ b/
client/src/components/ChallengeList.vue
@@
-10,7
+10,7
@@
div
tbody
tr(v-for="c in sortedChallenges" @click="$emit('click-challenge',c)")
td(data-label="Variant") {{ c.vname }}
tbody
tr(v-for="c in sortedChallenges" @click="$emit('click-challenge',c)")
td(data-label="Variant") {{ c.vname }}
- td(data-label="From") {{ c.from.name }}
+ td(data-label="From") {{ c.from.name
|| "@nonymous"
}}
td(data-label="To") {{ c.to }}
td(data-label="Cadence") {{ c.timeControl }}
</template>
td(data-label="To") {{ c.to }}
td(data-label="Cadence") {{ c.timeControl }}
</template>
diff --git
a/client/src/components/GameList.vue
b/client/src/components/GameList.vue
index
d0ea2f0
..
62c916f
100644
(file)
--- a/
client/src/components/GameList.vue
+++ b/
client/src/components/GameList.vue
@@
-7,7
+7,7
@@
div
th {{ st.tr["White"] }}
th {{ st.tr["Black"] }}
th {{ st.tr["Time control"] }}
th {{ st.tr["White"] }}
th {{ st.tr["Black"] }}
th {{ st.tr["Time control"] }}
- th
(v-if="showResult") Result
+ th
{{ st.tr["Result"] }}
tbody
tr(v-for="g in sortedGames" @click="$emit('show-game',g)"
:class="{'my-turn': g.myTurn}")
tbody
tr(v-for="g in sortedGames" @click="$emit('show-game',g)"
:class="{'my-turn': g.myTurn}")
@@
-15,7
+15,7
@@
div
td(data-label="White") {{ g.players[0].name || "@nonymous" }}
td(data-label="Black") {{ g.players[1].name || "@nonymous" }}
td(data-label="Time control") {{ g.timeControl }}
td(data-label="White") {{ g.players[0].name || "@nonymous" }}
td(data-label="Black") {{ g.players[1].name || "@nonymous" }}
td(data-label="Time control") {{ g.timeControl }}
- td(
v-if="showResult"
data-label="Result") {{ g.score }}
+ td(data-label="Result") {{ g.score }}
</template>
<script>
</template>
<script>
@@
-27,13
+27,11
@@
export default {
data: function() {
return {
st: store.state,
data: function() {
return {
st: store.state,
- showResult: false,
};
},
computed: {
sortedGames: function() {
// Show in order: games where it's my turn, my running games, my games, other games
};
},
computed: {
sortedGames: function() {
// Show in order: games where it's my turn, my running games, my games, other games
- this.showResult = this.games.some(g => g.score != "*");
let augmentedGames = this.games.map(g => {
let priority = 0;
if (g.players.some(p => p.uid == this.st.user.id || p.sid == this.st.user.sid))
let augmentedGames = this.games.map(g => {
let priority = 0;
if (g.players.some(p => p.uid == this.st.user.id || p.sid == this.st.user.sid))
diff --git
a/client/src/translations/en.js
b/client/src/translations/en.js
index
b84230a
..
8fa4547
100644
(file)
--- a/
client/src/translations/en.js
+++ b/
client/src/translations/en.js
@@
-67,6
+67,7
@@
export const translations =
"Registration complete! Please check your emails": "Registration complete! Please check your emails",
"Resign": "Resign",
"Resign the game?": "Resign the game?",
"Registration complete! Please check your emails": "Registration complete! Please check your emails",
"Resign": "Resign",
"Resign the game?": "Resign the game?",
+ "Result": "Result",
"Rules": "Rules",
"Sample game": "Sample game",
"Send": "Send",
"Rules": "Rules",
"Sample game": "Sample game",
"Send": "Send",
diff --git
a/client/src/views/Game.vue
b/client/src/views/Game.vue
index
35cec3a
..
608ac71
100644
(file)
--- a/
client/src/views/Game.vue
+++ b/
client/src/views/Game.vue
@@
-246,6
+246,7
@@
export default {
players: this.game.players,
vid: this.game.vid,
timeControl: this.game.timeControl,
players: this.game.players,
vid: this.game.vid,
timeControl: this.game.timeControl,
+ score: this.game.score,
};
this.st.conn.send(JSON.stringify({code:"game",
game:myGame, target:data.from}));
};
this.st.conn.send(JSON.stringify({code:"game",
game:myGame, target:data.from}));
diff --git
a/client/src/views/Hall.vue
b/client/src/views/Hall.vue
index
38ec2b3
..
39d7c16
100644
(file)
--- a/
client/src/views/Hall.vue
+++ b/
client/src/views/Hall.vue
@@
-405,7
+405,6
@@
export default {
newGame.type = this.classifyObject(data.game);
newGame.vname = this.getVname(data.game.vid);
newGame.rid = data.from;
newGame.type = this.classifyObject(data.game);
newGame.vname = this.getVname(data.game.vid);
newGame.rid = data.from;
- newGame.score = "*";
this.games.push(newGame);
}
break;
this.games.push(newGame);
}
break;
@@
-455,7
+454,7
@@
export default {
this.st.conn.send(JSON.stringify({code:"askgame", target:data.from}));
break;
case "disconnect":
this.st.conn.send(JSON.stringify({code:"askgame", target:data.from}));
break;
case "disconnect":
- case "
p
disconnect":
+ case "
g
disconnect":
this.$delete(this.people, data.from);
if (data.code == "disconnect")
{
this.$delete(this.people, data.from);
if (data.code == "disconnect")
{
diff --git
a/server/sockets.js
b/server/sockets.js
index
fcaab83
..
e7bb556
100644
(file)
--- a/
server/sockets.js
+++ b/
server/sockets.js
@@
-123,6
+123,10
@@
module.exports = function(wss) {
});
break;
}
});
break;
}
+ case "askgame":
+ clients[obj.target].sock.send(JSON.stringify(
+ {code:"askgame", from:sid}));
+ break;
case "askfullgame":
clients[obj.target].sock.send(JSON.stringify(
{code:"askfullgame", from:sid}));
case "askfullgame":
clients[obj.target].sock.send(JSON.stringify(
{code:"askfullgame", from:sid}));
@@
-167,7
+171,7
@@
module.exports = function(wss) {
notifyRoom(clients[sid].page, "newchat", {chat:obj.chat});
break;
// TODO: WebRTC instead in this case (most demanding?)
notifyRoom(clients[sid].page, "newchat", {chat:obj.chat});
break;
// TODO: WebRTC instead in this case (most demanding?)
- // -->
At least do a "notifyRoom"
+ // -->
Or else: at least do a "notifyRoom" (also for draw, resign...)
case "newmove":
clients[obj.target].sock.send(JSON.stringify(
{code:"newmove", move:obj.move}));
case "newmove":
clients[obj.target].sock.send(JSON.stringify(
{code:"newmove", move:obj.move}));