This commit is contained in:
sepia 2025-07-23 21:07:18 -05:00
parent a55f0890ce
commit f11b4c935f
2 changed files with 6 additions and 3 deletions

View File

@ -8,7 +8,9 @@ document.addEventListener('DOMContentLoaded', () => {
// Get playerId from meta tag // Get playerId from meta tag
const displayNameMeta = document.querySelector('meta[name="displayName"]'); const displayNameMeta = document.querySelector('meta[name="displayName"]');
const initialDisplayName = displayNameMeta ? displayNameMeta.content : 'New Player'; const initialDisplayName = displayNameMeta
? displayNameMeta.content
: 'New Player';
// Initialize display name with initial name // Initialize display name with initial name
displayNameSpan.textContent = initialDisplayName; displayNameSpan.textContent = initialDisplayName;

View File

@ -6,7 +6,7 @@ export function renderGameBoardHtml(
): string { ): string {
// Check the last move, so that the stone can be highlighted // Check the last move, so that the stone can be highlighted
const lastMove = game.history[game.history.length - 1]; const lastMove = game.history[game.history.length - 1];
let boardHtml = '<div id="game-board" class="game-board-grid">'; let boardHtml = '<div id="game-board" class="game-board-grid">';
for (let row = 0; row < game.board.length; row++) { for (let row = 0; row < game.board.length; row++) {
for (let col = 0; col < game.board[row].length; col++) { for (let col = 0; col < game.board[row].length; col++) {
@ -16,7 +16,8 @@ export function renderGameBoardHtml(
if (stone) { if (stone) {
const colorClass = const colorClass =
stone === 'black' ? 'stone-black-heart' : 'stone-white-heart'; stone === 'black' ? 'stone-black-heart' : 'stone-white-heart';
const lastMoveClass = col == lastMove.col && row == lastMove.row ? 'last-move' : ''; const lastMoveClass =
col == lastMove.col && row == lastMove.row ? 'last-move' : '';
stoneHtml = `<div class="${colorClass} ${lastMoveClass}"></div>`; stoneHtml = `<div class="${colorClass} ${lastMoveClass}"></div>`;
} }