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

43 行
1.1 KiB
JavaScript
Raw 通常表示 履歴

2020-02-29 01:39:47 +09:00
import Popover from '../popover/popover.vue'
import { mapGetters } from 'vuex'
const ReactButton = {
2020-05-08 06:10:49 +09:00
props: ['status'],
data () {
return {
2020-02-29 01:39:47 +09:00
filterWord: ''
}
},
2020-02-29 01:39:47 +09:00
components: {
Popover
},
methods: {
2020-02-29 01:39:47 +09:00
addReaction (event, emoji, close) {
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 01:39:47 +09:00
close()
}
},
computed: {
commonEmojis () {
return ['👍', '😠', '👀', '😂', '🔥']
},
emojis () {
if (this.filterWord !== '') {
2020-07-15 04:47:02 +09:00
const filterWordLowercase = this.filterWord.toLowerCase()
return this.$store.state.instance.emoji.filter(emoji =>
emoji.displayText.toLowerCase().includes(filterWordLowercase)
)
}
return this.$store.state.instance.emoji || []
},
...mapGetters(['mergedConfig'])
}
}
export default ReactButton