projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix chat
[vchess.git]
/
client
/
src
/
components
/
Chat.vue
diff --git
a/client/src/components/Chat.vue
b/client/src/components/Chat.vue
index
5834cbe
..
d8513b3
100644
(file)
--- 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"] }}
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 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>
</template>
<script>
@@
-29,8
+29,7
@@
export default {
const data = JSON.parse(msg.data);
if (data.code == "newchat") //only event at this level
{
const data = JSON.parse(msg.data);
if (data.code == "newchat") //only event at this level
{
- this.chats.unshift({msg:data.msg,
- name:data.name || "@nonymous", sid:data.from});
+ this.chats.unshift({msg:data.msg, name:data.name || "@nonymous"});
this.$emit("newchat-received"); //data not required here
}
};
this.$emit("newchat-received"); //data not required here
}
};
@@
-45,17
+44,16
@@
export default {
methods: {
classObject: function(chat) {
return {
methods: {
classObject: function(chat) {
return {
- "my-chatmsg": chat.
sid == this.st.user.sid
,
+ "my-chatmsg": chat.
name == this.st.user.name
,
"opp-chatmsg": this.players.some(
"opp-chatmsg": this.players.some(
- p => p.
sid == chat.sid && p.sid != this.st.user.sid
)
+ p => p.
name == chat.name && p.name != this.st.user.name
)
};
},
sendChat: function() {
let chatInput = document.getElementById("inputChat");
const chatTxt = chatInput.value;
chatInput.value = "";
};
},
sendChat: function() {
let chatInput = document.getElementById("inputChat");
const chatTxt = chatInput.value;
chatInput.value = "";
- const chat = {msg:chatTxt, name: this.st.user.name || "@nonymous",
- sid:this.st.user.sid};
+ const chat = {msg:chatTxt, name: this.st.user.name || "@nonymous"};
this.$emit("newchat-sent", chat); //useful for corr games
this.chats.unshift(chat);
this.st.conn.send(JSON.stringify({
this.$emit("newchat-sent", chat); //useful for corr games
this.chats.unshift(chat);
this.st.conn.send(JSON.stringify({
@@
-70,6
+68,4
@@
export default {
color: grey
.opp-chatmsg
color: black
color: grey
.opp-chatmsg
color: black
-#chat
- max-width: 100%
</style>
</style>