Commit 2e2b7a63 authored by Mahmoud Aglan's avatar Mahmoud Aglan

feat: add "تحليل اللعبة" (Analyze Game) button to game-over screen

Both bot games and live multiplayer games now show a gold "تحليل اللعبة"
button in the result overlay that navigates to /analysis?id={gameId}.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 5c443355
......@@ -320,12 +320,14 @@ const LiveGame = {
const wrapper = document.querySelector('.board-wrapper');
if (!wrapper) return;
const matchId = this.matchId;
const overlay = document.createElement('div');
overlay.className = 'game-result';
overlay.innerHTML =
'<div class="game-result-title">' + title + '</div>' +
'<div class="game-result-subtitle">' + subtitle + '</div>' +
'<div class="game-controls" style="margin-top:16px;">' +
'<div class="game-controls" style="margin-top:16px;display:flex;gap:8px;flex-wrap:wrap;justify-content:center;">' +
'<button class="btn btn-gold" onclick="window.location.href=\'/analysis?id=' + matchId + '\'">تحليل اللعبة</button>' +
'<button class="btn btn-cyan" onclick="window.location.href=\'/play\'">العب مرة اخرى</button>' +
'</div>';
wrapper.appendChild(overlay);
......
......@@ -606,6 +606,7 @@ const Game = {
const avgMoveTime = playerMoves.length > 0 ? (playerMoves.reduce((a, b) => a + b, 0) / playerMoves.length).toFixed(1) : '0';
const totalTimeUsed = playerMoves.length > 0 ? playerMoves.reduce((a, b) => a + b, 0).toFixed(1) : '0';
const gameId = this.gameId;
const overlay = document.createElement('div');
overlay.className = 'game-result';
overlay.innerHTML = '<div class="game-result-title">' + title + '</div>' +
......@@ -615,12 +616,18 @@ const Game = {
'<div class="stat-row"><span>متوسط وقت النقلة</span><span>' + avgMoveTime + 's</span></div>' +
'<div class="stat-row"><span>اجمالي الوقت</span><span>' + totalTimeUsed + 's</span></div>' +
'</div>' +
'<div class="game-controls" style="margin-top:16px;">' +
'<div class="game-controls" style="margin-top:16px;display:flex;gap:8px;flex-wrap:wrap;justify-content:center;">' +
'<button class="btn btn-gold" id="btn-analyze-result">تحليل اللعبة</button>' +
'<button class="btn btn-cyan" id="btn-rematch-result">اعادة</button>' +
'<button class="btn btn-ghost" onclick="window.location.href=\'/play\'">رجوع</button>' +
'</div>';
wrapper.appendChild(overlay);
const analyzeBtn = document.getElementById('btn-analyze-result');
if (analyzeBtn) {
analyzeBtn.onclick = () => { window.location.href = '/analysis?id=' + gameId; };
}
const rematchResultBtn = document.getElementById('btn-rematch-result');
if (rematchResultBtn) {
rematchResultBtn.onclick = () => this.rematch();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment