2018-12-13 02:00:01 +00:00
|
|
|
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
|
|
|
|
|
2018-01-26 14:11:34 +00:00
|
|
|
const chatPanel = {
|
2018-12-28 19:39:54 +00:00
|
|
|
props: [ 'floating' ],
|
2017-12-05 10:02:41 +00:00
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
currentMessage: '',
|
2018-04-10 21:17:05 +00:00
|
|
|
channel: null,
|
2018-04-24 07:48:30 +00:00
|
|
|
collapsed: true
|
2017-12-05 10:02:41 +00:00
|
|
|
}
|
|
|
|
},
|
2017-12-05 10:47:10 +00:00
|
|
|
computed: {
|
|
|
|
messages () {
|
|
|
|
return this.$store.state.chat.messages
|
|
|
|
}
|
2017-12-05 10:02:41 +00:00
|
|
|
},
|
|
|
|
methods: {
|
2017-12-05 10:49:40 +00:00
|
|
|
submit (message) {
|
2017-12-05 10:47:10 +00:00
|
|
|
this.$store.state.chat.channel.push('new_msg', {text: message}, 10000)
|
2017-12-05 10:49:40 +00:00
|
|
|
this.currentMessage = ''
|
2018-04-10 21:17:05 +00:00
|
|
|
},
|
|
|
|
togglePanel () {
|
|
|
|
this.collapsed = !this.collapsed
|
2018-12-16 23:52:27 +00:00
|
|
|
},
|
|
|
|
userProfileLink (user) {
|
2018-12-29 14:25:45 +00:00
|
|
|
return generateProfileLink(user.id, user.username, this.$store.state.instance.restrictedNicknames)
|
2017-12-05 10:02:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-26 14:11:34 +00:00
|
|
|
export default chatPanel
|