logo

pleroma-fe

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

favorite_button.js (997B)


  1. import { mapGetters } from 'vuex'
  2. import { library } from '@fortawesome/fontawesome-svg-core'
  3. import {
  4. faStar,
  5. faPlus,
  6. faMinus,
  7. faCheck
  8. } from '@fortawesome/free-solid-svg-icons'
  9. import {
  10. faStar as faStarRegular
  11. } from '@fortawesome/free-regular-svg-icons'
  12. library.add(
  13. faStar,
  14. faStarRegular,
  15. faPlus,
  16. faMinus,
  17. faCheck
  18. )
  19. const FavoriteButton = {
  20. props: ['status', 'loggedIn'],
  21. data () {
  22. return {
  23. animated: false
  24. }
  25. },
  26. methods: {
  27. favorite () {
  28. if (!this.status.favorited) {
  29. this.$store.dispatch('favorite', { id: this.status.id })
  30. } else {
  31. this.$store.dispatch('unfavorite', { id: this.status.id })
  32. }
  33. this.animated = true
  34. setTimeout(() => {
  35. this.animated = false
  36. }, 500)
  37. }
  38. },
  39. computed: {
  40. ...mapGetters(['mergedConfig']),
  41. remoteInteractionLink () {
  42. return this.$store.getters.remoteInteractionLink({ statusId: this.status.id })
  43. }
  44. }
  45. }
  46. export default FavoriteButton