BlueGit

projects-timfalken-com microchess

Add home link beside the shared replay share button.

Standalone replay pages keep a Microchess link to the main app next to the permanent share control.

Co-authored-by: Cursor <cursoragent@cursor.com>

timfa Tim Falken · pushed by timfa

Authored 2026-09-10 · 2 months ago

Hash
2b06d5e23c754d9a1ae2fe5de98bedd2d9d933c2
Parent
652b908d
3 files changed +3 −2
web/README.md +1 −1
@@ -154,4 +154,4 @@ Games newly entering Your turn go to the end of the queue; the ordering survives
154 154
155 155 Replays store the initial position plus two binary bytes per ply, including promotions, separately from permanent result/rating statistics. Saved games have no retention limit and are not automatically deleted based on age. Existing finished tiles can be imported when their original color and complete history are still available. Older rematches whose color was overwritten cannot be reconstructed reliably and are not imported. Data exports include available replay positions. No scheduled worker is required.
156 156
157 The replay footer’s chain icon copies a permanent link with an unguessable token. Anyone with that link can view and play back that one game without signing in. Shared links open a standalone replay page containing only the tile and playback/share controls, with no modal, close button or surrounding application interface. Replay headers identify White and Black with their king icons; transport buttons use previous-track, play/pause and next-track icons with accessible labels. Public replay responses include player names and game positions, not account IDs or private history. Invalid tokens return 404.
157 The replay footer’s chain icon copies a permanent link with an unguessable token. Anyone with that link can view and play back that one game without signing in. Shared links open a standalone replay page containing only the tile and playback/share controls, with no modal, close button or surrounding application interface, plus a Microchess link back to the home page. Replay headers identify White and Black with their king icons; transport buttons use previous-track, play/pause and next-track icons with accessible labels. Public replay responses include player names and game positions, not account IDs or private history. Invalid tokens return 404.
@@ -154,4 +154,4 @@ Games newly entering Your turn go to the end of the queue; the ordering survives
154
154
155Replays store the initial position plus two binary bytes per ply, including promotions, separately from permanent result/rating statistics. Saved games have no retention limit and are not automatically deleted based on age. Existing finished tiles can be imported when their original color and complete history are still available. Older rematches whose color was overwritten cannot be reconstructed reliably and are not imported. Data exports include available replay positions. No scheduled worker is required.
155Replays store the initial position plus two binary bytes per ply, including promotions, separately from permanent result/rating statistics. Saved games have no retention limit and are not automatically deleted based on age. Existing finished tiles can be imported when their original color and complete history are still available. Older rematches whose color was overwritten cannot be reconstructed reliably and are not imported. Data exports include available replay positions. No scheduled worker is required.
156
156
157The replay footer’s chain icon copies a permanent link with an unguessable token. Anyone with that link can view and play back that one game without signing in. Shared links open a standalone replay page containing only the tile and playback/share controls, with no modal, close button or surrounding application interface. Replay headers identify White and Black with their king icons; transport buttons use previous-track, play/pause and next-track icons with accessible labels. Public replay responses include player names and game positions, not account IDs or private history. Invalid tokens return 404.
157The replay footer’s chain icon copies a permanent link with an unguessable token. Anyone with that link can view and play back that one game without signing in. Shared links open a standalone replay page containing only the tile and playback/share controls, with no modal, close button or surrounding application interface, plus a Microchess link back to the home page. Replay headers identify White and Black with their king icons; transport buttons use previous-track, play/pause and next-track icons with accessible labels. Public replay responses include player names and game positions, not account IDs or private history. Invalid tokens return 404.
web/assets/app.js +1 −1
@@ -395,7 +395,7 @@ async function openReplay (id)
395 395 }
396 396 function showReplay (game)
397 397 {
398 const content = '<div id="replay-card"></div><div class="replay-controls"><button class="secondary" data-replay-control="back" aria-label="Previous move" title="Previous move; double-click for beginning">⏮</button><button class="primary" data-replay-control="play" aria-label="Play">▶</button><button class="secondary" data-replay-control="next" aria-label="Next move" title="Next move; double-click for end">⏭</button></div><p id="replay-progress" aria-live="polite"></p><div class="replay-bottom">' + (game.shared ? '' : '<button class="text-button" id="history-return">← Game history</button>') + '<button class="text-button" id="replay-share" aria-label="Copy game link" title="Copy game link">🔗</button></div>';
398 const content = '<div id="replay-card"></div><div class="replay-controls"><button class="secondary" data-replay-control="back" aria-label="Previous move" title="Previous move; double-click for beginning">⏮</button><button class="primary" data-replay-control="play" aria-label="Play">▶</button><button class="secondary" data-replay-control="next" aria-label="Next move" title="Next move; double-click for end">⏭</button></div><p id="replay-progress" aria-live="polite"></p><div class="replay-bottom">' + (game.shared ? '<a class="text-button" href="./">Microchess ↗</a>' : '<button class="text-button" id="history-return">← Game history</button>') + '<button class="text-button" id="replay-share" aria-label="Copy game link" title="Copy game link">🔗</button></div>';
399 399 if (game.shared) { stopReplay(); $('#modal-content').innerHTML = content; }
400 400 else { showModal(content); modal.classList.add('replay-modal'); }
401 401 replay = { ...game, index: 0 };
@@ -395,7 +395,7 @@ async function openReplay (id)
395}
395}
396function showReplay (game)
396function showReplay (game)
397{
397{
398 const content = '<div id="replay-card"></div><div class="replay-controls"><button class="secondary" data-replay-control="back" aria-label="Previous move" title="Previous move; double-click for beginning">⏮</button><button class="primary" data-replay-control="play" aria-label="Play">▶</button><button class="secondary" data-replay-control="next" aria-label="Next move" title="Next move; double-click for end">⏭</button></div><p id="replay-progress" aria-live="polite"></p><div class="replay-bottom">' + (game.shared ? '' : '<button class="text-button" id="history-return">← Game history</button>') + '<button class="text-button" id="replay-share" aria-label="Copy game link" title="Copy game link">🔗</button></div>';
398 const content = '<div id="replay-card"></div><div class="replay-controls"><button class="secondary" data-replay-control="back" aria-label="Previous move" title="Previous move; double-click for beginning">⏮</button><button class="primary" data-replay-control="play" aria-label="Play">▶</button><button class="secondary" data-replay-control="next" aria-label="Next move" title="Next move; double-click for end">⏭</button></div><p id="replay-progress" aria-live="polite"></p><div class="replay-bottom">' + (game.shared ? '<a class="text-button" href="./">Microchess ↗</a>' : '<button class="text-button" id="history-return">← Game history</button>') + '<button class="text-button" id="replay-share" aria-label="Copy game link" title="Copy game link">🔗</button></div>';
399 if (game.shared) { stopReplay(); $('#modal-content').innerHTML = content; }
399 if (game.shared) { stopReplay(); $('#modal-content').innerHTML = content; }
400 else { showModal(content); modal.classList.add('replay-modal'); }
400 else { showModal(content); modal.classList.add('replay-modal'); }
401 replay = { ...game, index: 0 };
401 replay = { ...game, index: 0 };
web/tests/browser.mjs +1 −0
@@ -183,6 +183,7 @@ try{
183 183 await guest.locator('#replay-card .board').waitFor();
184 184 assert.equal(await guest.locator('.replay-players').innerText(),await white.locator('.replay-players').innerText(),'Shared page identifies both players');
185 185 assert.equal(await guest.locator('#history-return').count(),0,'Public replay has no private history navigation');
186 assert.equal(await guest.locator('.replay-bottom a[href="./"]').innerText(),'Microchess ↗','Public replay links to the home page');
186 187 assert.equal(await guest.locator('dialog, #modal-close, .topbar, .login, #sidebar').count(),0,'Standalone replay has no dialog, close button or background UI');
187 188 await guest.keyboard.press('Escape');
188 189 await guest.locator('#replay-card .board').waitFor();
@@ -183,6 +183,7 @@ try{
183 await guest.locator('#replay-card .board').waitFor();
183 await guest.locator('#replay-card .board').waitFor();
184 assert.equal(await guest.locator('.replay-players').innerText(),await white.locator('.replay-players').innerText(),'Shared page identifies both players');
184 assert.equal(await guest.locator('.replay-players').innerText(),await white.locator('.replay-players').innerText(),'Shared page identifies both players');
185 assert.equal(await guest.locator('#history-return').count(),0,'Public replay has no private history navigation');
185 assert.equal(await guest.locator('#history-return').count(),0,'Public replay has no private history navigation');
186 assert.equal(await guest.locator('.replay-bottom a[href="./"]').innerText(),'Microchess ↗','Public replay links to the home page');
186 assert.equal(await guest.locator('dialog, #modal-close, .topbar, .login, #sidebar').count(),0,'Standalone replay has no dialog, close button or background UI');
187 assert.equal(await guest.locator('dialog, #modal-close, .topbar, .login, #sidebar').count(),0,'Standalone replay has no dialog, close button or background UI');
187 await guest.keyboard.press('Escape');
188 await guest.keyboard.press('Escape');
188 await guest.locator('#replay-card .board').waitFor();
189 await guest.locator('#replay-card .board').waitFor();