2018-12-13 13:00:01 +11:00
|
|
|
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
|
|
|
|
|
2018-01-27 01:11:34 +11:00
|
|
|
const chatPanel = {
|
2017-12-05 21:02:41 +11:00
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
currentMessage: '',
|
2018-04-11 07:17:05 +10:00
|
|
|
channel: null,
|
2018-04-24 17:48:30 +10:00
|
|
|
collapsed: true
|
2017-12-05 21:02:41 +11:00
|
|
|
}
|
|
|
|
},
|
2017-12-05 21:47:10 +11:00
|
|
|
computed: {
|
|
|
|
messages () {
|
|
|
|
return this.$store.state.chat.messages
|
|
|
|
}
|
2017-12-05 21:02:41 +11:00
|
|
|
},
|
|
|
|
methods: {
|
2017-12-05 21:49:40 +11:00
|
|
|
submit (message) {
|
2017-12-05 21:47:10 +11:00
|
|
|
this.$store.state.chat.channel.push('new_msg', {text: message}, 10000)
|
2017-12-05 21:49:40 +11:00
|
|
|
this.currentMessage = ''
|
2018-04-11 07:17:05 +10:00
|
|
|
},
|
|
|
|
togglePanel () {
|
|
|
|
this.collapsed = !this.collapsed
|
2018-12-17 10:52:27 +11:00
|
|
|
},
|
|
|
|
userProfileLink (user) {
|
|
|
|
return generateProfileLink(user.id, user.screen_name)
|
2017-12-05 21:02:41 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-27 01:11:34 +11:00
|
|
|
export default chatPanel
|