2020-02-29 01:39:47 +09:00
|
|
|
import Popover from '../popover/popover.vue'
|
2022-12-19 04:04:58 +09:00
|
|
|
import EmojiPicker from '../emoji_picker/emoji_picker.vue'
|
2020-10-20 01:38:49 +09:00
|
|
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
2022-01-16 15:01:19 +09:00
|
|
|
import { faPlus, faTimes } from '@fortawesome/free-solid-svg-icons'
|
2020-10-20 01:38:49 +09:00
|
|
|
import { faSmileBeam } from '@fortawesome/free-regular-svg-icons'
|
|
|
|
|
2022-01-16 15:01:19 +09:00
|
|
|
library.add(
|
|
|
|
faPlus,
|
|
|
|
faTimes,
|
|
|
|
faSmileBeam
|
|
|
|
)
|
2019-11-15 23:29:25 +09:00
|
|
|
|
|
|
|
const ReactButton = {
|
2020-05-08 06:10:49 +09:00
|
|
|
props: ['status'],
|
2019-11-15 23:29:25 +09:00
|
|
|
data () {
|
|
|
|
return {
|
2022-01-16 15:01:19 +09:00
|
|
|
filterWord: '',
|
|
|
|
expanded: false
|
2019-11-15 23:29:25 +09:00
|
|
|
}
|
|
|
|
},
|
2020-02-29 01:39:47 +09:00
|
|
|
components: {
|
2022-12-19 04:04:58 +09:00
|
|
|
Popover,
|
|
|
|
EmojiPicker
|
2020-02-29 01:39:47 +09:00
|
|
|
},
|
2019-11-15 23:29:25 +09:00
|
|
|
methods: {
|
2022-12-19 04:04:58 +09:00
|
|
|
addReaction (event) {
|
|
|
|
const emoji = event.insertion
|
2020-02-11 21:24:51 +09: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 })
|
|
|
|
}
|
2022-12-19 04:04:58 +09:00
|
|
|
},
|
|
|
|
show () {
|
|
|
|
if (!this.expanded) {
|
|
|
|
this.$refs.picker.showPicker()
|
|
|
|
}
|
2021-02-26 00:27:29 +09:00
|
|
|
},
|
2022-01-16 15:01:19 +09:00
|
|
|
onShow () {
|
|
|
|
this.expanded = true
|
|
|
|
},
|
|
|
|
onClose () {
|
|
|
|
this.expanded = false
|
2019-11-15 23:29:25 +09:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2020-09-29 19:18:37 +09:00
|
|
|
mergedConfig () {
|
|
|
|
return this.$store.getters.mergedConfig
|
|
|
|
}
|
2019-11-15 23:29:25 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ReactButton
|