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 (2919B)


  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. buttonInnerClass () {
  87. return [
  88. this.button.name + '-button',
  89. {
  90. 'main-button': this.extra,
  91. 'button-unstyled': !this.extra,
  92. '-active': this.button.active?.(this.funcArg),
  93. disabled: this.button.interactive ? !this.button.interactive(this.funcArg) : false
  94. }
  95. ]
  96. },
  97. remoteInteractionLink () {
  98. return this.$store.getters.remoteInteractionLink({ statusId: this.status.id })
  99. }
  100. },
  101. methods: {
  102. addReaction (event) {
  103. const emoji = event.insertion
  104. const existingReaction = this.status.emoji_reactions.find(r => r.name === emoji)
  105. if (existingReaction && existingReaction.me) {
  106. this.$store.dispatch('unreactWithEmoji', { id: this.status.id, emoji })
  107. } else {
  108. this.$store.dispatch('reactWithEmoji', { id: this.status.id, emoji })
  109. }
  110. },
  111. doActionWrap (button, close) {
  112. if (button.name === 'emoji') {
  113. this.$refs.picker.showPicker()
  114. } else {
  115. this.animationState = true
  116. this.getComponent(button) === 'button' && this.doAction(button)
  117. setTimeout(() => {
  118. this.animationState = false
  119. }, 500)
  120. close()
  121. }
  122. }
  123. }
  124. }