From bfe9a1357f43c2a2cc271e0f244f4785363d7961 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Tue, 4 Feb 2020 10:09:10 +0100
Subject: [PATCH] Fix chat

---
 client/src/components/Chat.vue |  4 ++--
 client/src/views/Game.vue      | 11 ++++-------
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/client/src/components/Chat.vue b/client/src/components/Chat.vue
index 18ce6fa9..d8513b31 100644
--- a/client/src/components/Chat.vue
+++ b/client/src/components/Chat.vue
@@ -3,10 +3,10 @@ div
   input#inputChat(type="text" :placeholder="st.tr['Type here']"
     @keyup.enter="sendChat")
   button#sendChatBtn(@click="sendChat") {{ st.tr["Send"] }}
-  p(v-for="chat in pastChats" :class="classObject(chat)"
-    v-html="chat.name + ': ' + chat.msg")
   p(v-for="chat in chats" :class="classObject(chat)"
     v-html="chat.name + ': ' + chat.msg")
+  p(v-for="chat in pastChats" :class="classObject(chat)"
+    v-html="chat.name + ': ' + chat.msg")
 </template>
 
 <script>
diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue
index e77492f0..2682a60a 100644
--- a/client/src/views/Game.vue
+++ b/client/src/views/Game.vue
@@ -1,6 +1,6 @@
 <template lang="pug">
 main
-  input#modalChat.modal(type="checkbox" @change="toggleChat")
+  input#modalChat.modal(type="checkbox" @click="resetChatColor")
   div#chatWrap(role="dialog" data-checkbox="modalChat"
       aria-labelledby="inputChat")
     #chat.card
@@ -555,12 +555,9 @@ export default {
       if (this.repeat[repIdx] >= 3)
         this.drawOffer = "threerep";
     },
-    toggleChat: function() {
-      let modalChat = document.getElementById("modalChat");
-      modalChat.style.backgroundColor =
-        (modalChat.style.backgroundColor == "#e2e2e2"
-          ? "#c5fefe"
-          : "#e2e2e2");
+    resetChatColor: function() {
+      // TODO: this is called twice, once on opening an once on closing
+      document.getElementById("chatBtn").style.backgroundColor = "#e2e2e2";
     },
     finishSendChat: function(chat) {
       // NOTE: anonymous chats in corr games are not stored on server (TODO?)
-- 
2.44.0