2020-02-29 03:39:47 +11:00
|
|
|
import Popover from '../popover/popover.vue'
|
2019-11-16 01:29:25 +11:00
|
|
|
import { mapGetters } from 'vuex'
|
|
|
|
|
|
|
|
const ReactButton = {
|
2020-05-08 07:10:49 +10:00
|
|
|
props: ['status'],
|
2019-11-16 01:29:25 +11:00
|
|
|
data () {
|
|
|
|
return {
|
2020-02-29 03:39:47 +11:00
|
|
|
filterWord: ''
|
2019-11-16 01:29:25 +11:00
|
|
|
}
|
|
|
|
},
|
2020-02-29 03:39:47 +11:00
|
|
|
components: {
|
|
|
|
Popover
|
|
|
|
},
|
2019-11-16 01:29:25 +11:00
|
|
|
methods: {
|
2020-02-29 03:39:47 +11:00
|
|
|
addReaction (event, emoji, close) {
|
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-02-29 03:39:47 +11:00
|
|
|
close()
|
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
|