projects
/
vchess.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
becbc69
)
Display a clear message in the middle of the screen when a game ends
author
Benjamin Auder
<benjamin.auder@somewhere>
Sun, 5 Apr 2020 01:02:46 +0000
(
03:02
+0200)
committer
Benjamin Auder
<benjamin.auder@somewhere>
Sun, 5 Apr 2020 01:02:46 +0000
(
03:02
+0200)
client/src/views/Game.vue
patch
|
blob
|
blame
|
history
diff --git
a/client/src/views/Game.vue
b/client/src/views/Game.vue
index
eefb337
..
0398875
100644
(file)
--- a/
client/src/views/Game.vue
+++ b/
client/src/views/Game.vue
@@
-1,15
+1,26
@@
<template lang="pug">
main
<template lang="pug">
main
- input#modal
Info
.modal(type="checkbox")
- div#
info
Div(
+ input#modal
Score
.modal(type="checkbox")
+ div#
score
Div(
role="dialog"
role="dialog"
- data-checkbox="modal
Info
"
+ data-checkbox="modal
Score
"
)
.card.text-center
)
.card.text-center
- label.modal-close(for="modalInfo")
+ label.modal-close(for="modalScore")
+ p
+ span.score {{ game.score }}
+ | :
+ span.score-msg {{ st.tr[game.scoreMsg] }}
+ input#modalRematch.modal(type="checkbox")
+ div#rematchDiv(
+ role="dialog"
+ data-checkbox="modalRematch"
+ )
+ .card.text-center
+ label.modal-close(for="modalRematch")
a(
:href="'#/game/' + rematchId"
a(
:href="'#/game/' + rematchId"
- onClick="document.getElementById('modal
Info
').checked=false"
+ onClick="document.getElementById('modal
Rematch
').checked=false"
)
| {{ st.tr["Rematch in progress"] }}
input#modalChat.modal(
)
| {{ st.tr["Rematch in progress"] }}
input#modalChat.modal(
@@
-242,8
+253,12
@@
export default {
this.toggleChat("close")
});
});
this.toggleChat("close")
});
});
- document.getElementById("infoDiv")
- .addEventListener("click", processModalClick);
+ ["rematchDiv", "scoreDiv"].forEach(
+ (eltName) => {
+ document.getElementById(eltName)
+ .addEventListener("click", processModalClick);
+ }
+ );
if ("ontouchstart" in window) {
// Disable tooltips on smartphones:
document.querySelectorAll("#aboveBoard .tooltip").forEach(elt => {
if ("ontouchstart" in window) {
// Disable tooltips on smartphones:
document.querySelectorAll("#aboveBoard .tooltip").forEach(elt => {
@@
-853,7
+868,7
@@
export default {
this.$router.push("/game/" + gameInfo.id);
} else {
this.rematchId = gameInfo.id;
this.$router.push("/game/" + gameInfo.id);
} else {
this.rematchId = gameInfo.id;
- document.getElementById("modal
Info
").checked = true;
+ document.getElementById("modal
Rematch
").checked = true;
}
break;
}
}
break;
}
@@
-1523,6
+1538,8
@@
export default {
this.game.score = score;
if (!scoreMsg) scoreMsg = getScoreMessage(score);
this.game.scoreMsg = scoreMsg;
this.game.score = score;
if (!scoreMsg) scoreMsg = getScoreMessage(score);
this.game.scoreMsg = scoreMsg;
+ // Display result in a un-missable way:
+ document.getElementById("modalScore").checked = true;
this.$set(this.game, "scoreMsg", scoreMsg);
const myIdx = this.game.players.findIndex(p => {
return p.sid == this.st.user.sid || p.id == this.st.user.id;
this.$set(this.game, "scoreMsg", scoreMsg);
const myIdx = this.game.players.findIndex(p => {
return p.sid == this.st.user.sid || p.id == this.st.user.id;
@@
-1564,10
+1581,13
@@
export default {
</script>
<style lang="sass" scoped>
</script>
<style lang="sass" scoped>
-#
info
Div > .card
+#
scoreDiv > .card, #rematch
Div > .card
padding: 15px 0
max-width: 430px
padding: 15px 0
max-width: 430px
+span.score
+ font-weight: bold
+
.connected
background-color: lightgreen
.connected
background-color: lightgreen