Skip to content

Commit 28cf202

Browse files
making sure button to report is only visible if current match hasnt started not if it doesnt exist or oalready startyed
1 parent 7bc6e26 commit 28cf202

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

app.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ async function afterSignIn(user) {
102102
const url = new URL(userData.currentGameUrl)
103103
const gameId = url.pathname.slice(1);
104104
document.getElementById("userGame").src = `https://lichess.org/embed/${gameId}?theme=auto&bg=auto&move=last`;
105+
106+
if (!checkIfFirstMove(gameId)) {
107+
document.getElementById("reportButton").style.display = "block";
108+
} // display report button only if match hasn't started
105109
}
106110

107111
loadLeaderboard();

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ <h1>Welcome to the Year 8 Chess Tournament</h1>
2424

2525
<div id="game-panel" style="display:none; text-align: center;">
2626
<h2>Your Current Game</h2>
27-
<a id="game-link" href="#" target="_blank">Join Game</a><br><br>
27+
<a id="game-link" href="#" target="_blank"><button>Join Game</button></a><br><br>
2828
<div class="iframe-wrapper">
2929
<div class="iframe-loader"></div>
3030
<iframe id="userGame" src="" onload="hideIframeLoader(this)"></iframe>
3131
</div>
3232
<br>
33-
<button onclick="reportTroll()">Report Opponent</button>
33+
<button id="reportButton" style="display:none;" onclick="reportTroll()">Report Opponent</button>
3434
</div>
3535

3636
<h2>Leaderboard</h2>

0 commit comments

Comments
 (0)