logo

pleroma-fe

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

action_button.js (3029B)


  1. import StatusBookmarkFolderMenu from 'src/components/status_bookmark_folder_menu/status_bookmark_folder_menu.vue'
  2. import EmojiPicker from 'src/components/emoji_picker/emoji_picker.vue'
  3. import Popover from 'src/components/popover/popover.vue'
  4. import { library } from '@fortawesome/fontawesome-svg-core'
  5. import {
  6. faPlus,
  7. faMinus,
  8. faCheck,
  9. faTimes,
  10. faWrench,
  11. faChevronRight,
  12. faChevronUp,
  13. faReply,
  14. faRetweet,
  15. faStar,
  16. faSmileBeam,
  17. faBookmark,
  18. faEyeSlash,
  19. faThumbtack,
  20. faShareAlt,
  21. faExternalLinkAlt,
  22. faHistory
  23. } from '@fortawesome/free-solid-svg-icons'
  24. import {
  25. faStar as faStarRegular,
  26. faBookmark as faBookmarkRegular
  27. } from '@fortawesome/free-regular-svg-icons'
  28. library.add(
  29. faPlus,
  30. faMinus,
  31. faCheck,
  32. faTimes,
  33. faWrench,
  34. faChevronRight,
  35. faChevronUp,
  36. faReply,
  37. faRetweet,
  38. faStar,
  39. faStarRegular,
  40. faSmileBeam,
  41. faBookmark,
  42. faBookmarkRegular,
  43. faEyeSlash,
  44. faThumbtack,
  45. faShareAlt,
  46. faExternalLinkAlt,
  47. faHistory
  48. )
  49. export default {
  50. props: [
  51. 'button',
  52. 'status',
  53. 'extra',
  54. 'status',
  55. 'funcArg',
  56. 'getClass',
  57. 'getComponent',
  58. 'doAction',
  59. 'close'
  60. ],
  61. components: {
  62. StatusBookmarkFolderMenu,
  63. EmojiPicker,
  64. Popover
  65. },
  66. data: () => ({
  67. animationState: false
  68. }),
  69. computed: {
  70. buttonClass () {
  71. return [
  72. this.button.name + '-button',
  73. {
  74. '-with-extra': this.button.name === 'bookmark',
  75. '-extra': this.extra,
  76. '-quick': !this.extra
  77. }
  78. ]
  79. },
  80. userIsMuted () {
  81. return this.$store.getters.relationship(this.status.user.id).muting
  82. },
  83. threadIsMuted () {
  84. return this.status.thread_muted
  85. },
  86. hideCustomEmoji () {
  87. return !this.$store.state.instance.pleromaCustomEmojiReactionsAvailable
  88. },
  89. buttonInnerClass () {
  90. return [
  91. this.button.name + '-button',
  92. {
  93. 'main-button': this.extra,
  94. 'button-unstyled': !this.extra,
  95. '-active': this.button.active?.(this.funcArg),
  96. disabled: this.button.interactive ? !this.button.interactive(this.funcArg) : false
  97. }
  98. ]
  99. },
  100. remoteInteractionLink () {
  101. return this.$store.getters.remoteInteractionLink({ statusId: this.status.id })
  102. }
  103. },
  104. methods: {
  105. addReaction (event) {
  106. const emoji = event.insertion
  107. const existingReaction = this.status.emoji_reactions.find(r => r.name === emoji)
  108. if (existingReaction && existingReaction.me) {
  109. this.$store.dispatch('unreactWithEmoji', { id: this.status.id, emoji })
  110. } else {
  111. this.$store.dispatch('reactWithEmoji', { id: this.status.id, emoji })
  112. }
  113. },
  114. doActionWrap (button, close) {
  115. if (button.name === 'emoji') {
  116. this.$refs.picker.showPicker()
  117. } else {
  118. this.animationState = true
  119. this.getComponent(button) === 'button' && this.doAction(button)
  120. setTimeout(() => {
  121. this.animationState = false
  122. }, 500)
  123. close()
  124. }
  125. }
  126. }
  127. }