2019-11-16 01:29:25 +11:00
|
|
|
import { mapGetters } from 'vuex'
|
|
|
|
|
|
|
|
const ReactButton = {
|
|
|
|
props: ['status', 'loggedIn'],
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
animated: false,
|
|
|
|
showTooltip: false,
|
2020-01-14 08:34:39 +11:00
|
|
|
filterWord: '',
|
2019-11-16 01:29:25 +11:00
|
|
|
popperOptions: {
|
|
|
|
modifiers: {
|
|
|
|
preventOverflow: { padding: { top: 50 }, boundariesElement: 'viewport' }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2020-01-14 19:06:14 +11:00
|
|
|
openReactionSelect () {
|
|
|
|
this.showTooltip = true
|
|
|
|
this.filterWord = ''
|
2019-11-16 01:29:25 +11:00
|
|
|
},
|
|
|
|
closeReactionSelect () {
|
|
|
|
this.showTooltip = false
|
|
|
|
},
|
2020-01-14 08:34:39 +11:00
|
|
|
addReaction (event, emoji) {
|
|
|
|
this.$store.dispatch('reactWithEmoji', { id: this.status.id, emoji })
|
|
|
|
this.closeReactionSelect()
|
2019-11-16 01:29:25 +11:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2020-01-14 08:34:39 +11:00
|
|
|
commonEmojis () {
|
|
|
|
return ['💖', '😠', '👀', '😂', '🔥']
|
|
|
|
},
|
2019-11-16 01:29:25 +11:00
|
|
|
emojis () {
|
2020-01-14 08:34:39 +11:00
|
|
|
if (this.filterWord !== '') {
|
|
|
|
return this.$store.state.instance.emoji.filter(emoji => emoji.displayText.includes(this.filterWord))
|
|
|
|
}
|
2019-11-16 01:29:25 +11:00
|
|
|
return this.$store.state.instance.emoji || []
|
|
|
|
},
|
|
|
|
classes () {
|
|
|
|
return {
|
|
|
|
'icon-smile': true,
|
|
|
|
'animate-spin': this.animated
|
|
|
|
}
|
|
|
|
},
|
|
|
|
...mapGetters(['mergedConfig'])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ReactButton
|