From: Geoffrey Allott Date: Sun, 21 Mar 2021 14:22:06 +0000 (+0000) Subject: populate chat with actions and error messages X-Git-Url: https://git.pointlesshacks.com/?a=commitdiff_plain;h=f98a81045e4efb0bd08c7cbf09546c28f38ab425;p=pokerwave.git populate chat with actions and error messages --- diff --git a/site/modules/chatroom.js b/site/modules/chatroom.js index 242ac19..4046da2 100644 --- a/site/modules/chatroom.js +++ b/site/modules/chatroom.js @@ -32,7 +32,7 @@ export class Chatroom { } set_error_text(text) { - this.chat.append(this.chat_element("chatroom-error", "«error»", message)); + this.chat.append(this.chat_element("chatroom-error", "«error»", text)); } take_action(user_action, initialising) { diff --git a/site/modules/poker.js b/site/modules/poker.js index 6ea0fd5..a6c88b5 100644 --- a/site/modules/poker.js +++ b/site/modules/poker.js @@ -227,13 +227,14 @@ export class TexasHoldEm { this.svg.append(this.chat_control); this.container.append(this.svg); - for (const user_action of this.actions) { - this.take_action(user_action); - } this.chatroom_container = document.createElement("div"); this.chatroom_container.classList.add("embedded-chatroom"); - this.chatroom = new Chatroom(this.chatroom_container, summary, actions, username, send); + this.chatroom = new Chatroom(this.chatroom_container, summary, [], username, send); + + for (const user_action of this.actions) { + this.take_action(user_action); + } this.container.append(this.chatroom_container); @@ -265,6 +266,7 @@ export class TexasHoldEm { } set_error_text(text) { + this.chatroom.set_error_text(text); this.set_text("game-error", text); } @@ -429,6 +431,7 @@ export class TexasHoldEm { } take_action(user_action) { + this.chatroom.take_action(user_action); switch (user_action.action.action) { case "Join": this.seats.set(user_action.username, user_action.action.seat);