diff --git a/public/js/app.js b/public/js/app.js index 3299e12..f5fa212 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -971,31 +971,74 @@ document.addEventListener('DOMContentLoaded', () => { if (state.playerList !== playerListHtml && elements.playerList) { elements.playerList.innerHTML = playerListHtml; state.playerList = playerListHtml; - + // Toggle action buttons document.querySelectorAll('.toggle-actions').forEach(button => { button.addEventListener('click', () => { const player = button.getAttribute('data-player').trim(); const actionDiv = document.querySelector(`.action-buttons[data-player="${player}"]`); if (actionDiv) { - actionDiv.classList.toggle('hidden'); - button.textContent = actionDiv.classList.contains('hidden') ? 'Actions' : 'Hide'; - } - }); - }); - - // Close action buttons - document.querySelectorAll('.close-actions').forEach(button => { - button.addEventListener('click', () => { - const player = button.getAttribute('data-player').trim(); - const actionDiv = document.querySelector(`.action-buttons[data-player="${player}"]`); - const toggleButton = document.querySelector(`.toggle-actions[data-player="${player}"]`); - if (actionDiv && toggleButton) { - actionDiv.classList.add('hidden'); - toggleButton.textContent = 'Actions'; + actionDiv.classList.remove('hidden'); + button.classList.add('hidden'); } }); }); + + if (message.type === 'list-players' && message.data?.players) { + const players = message.data.players || []; + state.currentPlayers = players; + const isSinglePlayer = players.length <= 1; + const playerListHtml = players.length > 0 + ? players.map(player => ` +