projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Started code review + some fixes (unfinished)
[vchess.git]
/
client
/
src
/
components
/
Chat.vue
diff --git
a/client/src/components/Chat.vue
b/client/src/components/Chat.vue
index
ae85e73
..
7205f3b
100644
(file)
--- a/
client/src/components/Chat.vue
+++ b/
client/src/components/Chat.vue
@@
-13,38
+13,40
@@
import { store } from "@/store";
export default {
name: "my-chat",
// Prop 'pastChats' for corr games where chats are on server
export default {
name: "my-chat",
// Prop 'pastChats' for corr games where chats are on server
- props: ["players",
"pastChats",
"newChat"],
+ props: ["players",
"pastChats",
"newChat"],
data: function() {
return {
st: store.state,
data: function() {
return {
st: store.state,
- chats: []
,
//chat messages after human game
+ chats: [] //chat messages after human game
};
},
watch: {
newChat: function(chat) {
if (chat.msg != "")
};
},
watch: {
newChat: function(chat) {
if (chat.msg != "")
- this.chats.unshift({
msg:chat.msg, name:chat.name || "@nonymous"
});
- }
,
+ this.chats.unshift({
msg: chat.msg, name: chat.name || "@nonymous"
});
+ }
},
methods: {
classObject: function(chat) {
return {
"my-chatmsg": chat.name == this.st.user.name,
},
methods: {
classObject: function(chat) {
return {
"my-chatmsg": chat.name == this.st.user.name,
- "opp-chatmsg": !!this.players && this.players.some(
- p => p.name == chat.name && p.name != this.st.user.name)
+ "opp-chatmsg":
+ !!this.players &&
+ this.players.some(
+ p => p.name == chat.name && p.name != this.st.user.name
+ )
};
},
sendChat: function() {
let chatInput = document.getElementById("inputChat");
const chatTxt = chatInput.value.trim();
};
},
sendChat: function() {
let chatInput = document.getElementById("inputChat");
const chatTxt = chatInput.value.trim();
- if (chatTxt == "")
- return; //nothing to send
+ if (chatTxt == "") return; //nothing to send
chatInput.value = "";
chatInput.value = "";
- const chat = {
msg:chatTxt, name: this.st.user.name || "@nonymous"
};
+ const chat = {
msg: chatTxt, name: this.st.user.name || "@nonymous"
};
this.$emit("mychat", chat);
this.chats.unshift(chat);
this.$emit("mychat", chat);
this.chats.unshift(chat);
- }
,
- }
,
+ }
+ }
};
</script>
};
</script>