pleroma-fe/src/components/chat_panel/chat_panel.js

32 lines
732 B
JavaScript
Raw Normal View History

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