2019-11-16 01:29:25 +11:00
|
|
|
import { mapGetters } from 'vuex'
|
|
|
|
|
|
|
|
const ReactButton = {
|
|
|
|
props: ['status', 'loggedIn'],
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
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) {
|
2020-02-11 23:24:51 +11:00
|
|
|
const existingReaction = this.status.emoji_reactions.find(r => r.name === emoji)
|
|
|
|
if (existingReaction && existingReaction.me) {
|
|
|
|
this.$store.dispatch('unreactWithEmoji', { id: this.status.id, emoji })
|
|
|
|
} else {
|
|
|
|
this.$store.dispatch('reactWithEmoji', { id: this.status.id, emoji })
|
|
|
|
}
|
2020-01-14 08:34:39 +11:00
|
|
|
this.closeReactionSelect()
|
2019-11-16 01:29:25 +11:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2020-01-14 08:34:39 +11:00
|
|
|
commonEmojis () {
|
2020-01-29 02:09:25 +11:00
|
|
|
return ['❤️', '😠', '👀', '😂', '🔥']
|
2020-01-14 08:34:39 +11:00
|
|
|
},
|
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 || []
|
|
|
|
},
|
|
|
|
...mapGetters(['mergedConfig'])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ReactButton
|