X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FMyGames.vue;h=13632041b0d45452e4ca08870dfba071d3b0c826;hb=0705a80c63aec2c60ee6a674b982f6a11d2d50bd;hp=52e6dc3beb9041beca07ec60f7fb84c4dbe47fbf;hpb=1ef65040168ab7d55ce921abc9d63644a937d689;p=vchess.git diff --git a/client/src/views/MyGames.vue b/client/src/views/MyGames.vue index 52e6dc3b..13632041 100644 --- a/client/src/views/MyGames.vue +++ b/client/src/views/MyGames.vue @@ -31,6 +31,7 @@ main v-show="display=='import'" ref="importgames" :games="importGames" + :show-both="true" @show-game="showGame" ) button#loadMoreBtn( @@ -111,7 +112,7 @@ export default { }, mounted: function() { const adjustAndSetDisplay = () => { - // showType is the last type viwed by the user (default) + // showType is the last type viewed by the user (default) let showType = localStorage.getItem("type-myGames") || "live"; // Live games, my turn: highest priority: if (this.liveGames.some(g => !!g.myTurn)) showType = "live"; @@ -182,7 +183,7 @@ export default { setDisplay: function(type, e) { this.display = type; localStorage.setItem("type-myGames", type); - let elt = e ? e.target : document.getElementById(type + "Games"); + let elt = (!!e ? e.target : document.getElementById(type + "Games")); elt.classList.add("active"); elt.classList.remove("somethingnew"); //in case of for (let t of ["live","corr","import"]) { @@ -198,6 +199,8 @@ export default { alert(this.st.tr["An error occurred. Try again!"]); return; } + // NOTE: since a random new ID is generated for imported games, + // this error will not occur. else alert(this.st.tr["The game was already imported"]); } this.$router.push("/game/" + game.id); @@ -249,7 +252,8 @@ export default { if (thing == "turn") { game.myTurn = !game.myTurn; if (game.myTurn) this.tryShowNewsIndicator(type); - } else game.myTurn = false; + } + else game.myTurn = false; // TODO: forcing refresh like that is ugly and wrong. // How to do it cleanly? this.$refs[type + "games"].$forceUpdate(); @@ -354,7 +358,8 @@ export default { moreGames.forEach(g => g.type = "corr"); this.decorate(moreGames); this.corrGames = this.corrGames.concat(moreGames); - } else this.hasMore["corr"] = false; + } + else this.hasMore["corr"] = false; if (!!cb) cb(); } } @@ -369,7 +374,8 @@ export default { localGames.forEach(g => g.type = "live"); this.decorate(localGames); this.liveGames = this.liveGames.concat(localGames); - } else this.hasMore["live"] = false; + } + else this.hasMore["live"] = false; if (!!cb) cb(); }); } @@ -381,7 +387,8 @@ export default { this.cursor["import"] = importGames[L - 1].created - 1; importGames.forEach(g => g.type = "import"); this.importGames = this.importGames.concat(importGames); - } else this.hasMore["import"] = false; + } + else this.hasMore["import"] = false; if (!!cb) cb(); }); } @@ -390,20 +397,23 @@ export default { }; - + + +