logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git

react_button.js (1285B)


  1. import Popover from '../popover/popover.vue'
  2. import EmojiPicker from '../emoji_picker/emoji_picker.vue'
  3. import { library } from '@fortawesome/fontawesome-svg-core'
  4. import { faPlus, faTimes } from '@fortawesome/free-solid-svg-icons'
  5. import { faSmileBeam } from '@fortawesome/free-regular-svg-icons'
  6. library.add(
  7. faPlus,
  8. faTimes,
  9. faSmileBeam
  10. )
  11. const ReactButton = {
  12. props: ['status'],
  13. data () {
  14. return {
  15. filterWord: '',
  16. expanded: false
  17. }
  18. },
  19. components: {
  20. Popover,
  21. EmojiPicker
  22. },
  23. methods: {
  24. addReaction (event) {
  25. const emoji = event.insertion
  26. const existingReaction = this.status.emoji_reactions.find(r => r.name === emoji)
  27. if (existingReaction && existingReaction.me) {
  28. this.$store.dispatch('unreactWithEmoji', { id: this.status.id, emoji })
  29. } else {
  30. this.$store.dispatch('reactWithEmoji', { id: this.status.id, emoji })
  31. }
  32. },
  33. show () {
  34. if (!this.expanded) {
  35. this.$refs.picker.showPicker()
  36. }
  37. },
  38. onShow () {
  39. this.expanded = true
  40. },
  41. onClose () {
  42. this.expanded = false
  43. }
  44. },
  45. computed: {
  46. hideCustomEmoji () {
  47. return !this.$store.state.instance.pleromaCustomEmojiReactionsAvailable
  48. }
  49. }
  50. }
  51. export default ReactButton