logo

pleroma-fe

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

status_popover.js (1160B)


  1. import { find } from 'lodash'
  2. import { library } from '@fortawesome/fontawesome-svg-core'
  3. import { faCircleNotch } from '@fortawesome/free-solid-svg-icons'
  4. import { defineAsyncComponent } from 'vue'
  5. library.add(
  6. faCircleNotch
  7. )
  8. const StatusPopover = {
  9. name: 'StatusPopover',
  10. props: [
  11. 'statusId'
  12. ],
  13. data () {
  14. return {
  15. error: false
  16. }
  17. },
  18. computed: {
  19. status () {
  20. return find(this.$store.state.statuses.allStatuses, { id: this.statusId })
  21. }
  22. },
  23. components: {
  24. Status: defineAsyncComponent(() => import('../status/status.vue')),
  25. Popover: defineAsyncComponent(() => import('../popover/popover.vue'))
  26. },
  27. methods: {
  28. enter () {
  29. if (!this.status) {
  30. if (!this.statusId) {
  31. this.error = true
  32. return
  33. }
  34. this.$store.dispatch('fetchStatus', this.statusId)
  35. .then(data => (this.error = false))
  36. .catch(e => (this.error = true))
  37. }
  38. }
  39. },
  40. watch: {
  41. status (newStatus, oldStatus) {
  42. if (newStatus !== oldStatus) {
  43. this.$nextTick(() => this.$refs.popover.updateStyles())
  44. }
  45. }
  46. }
  47. }
  48. export default StatusPopover