pleroma-fe/src/components/status_popover/status_popover.js

49 lines
1.1 KiB
JavaScript
Raw Normal View History

2026-01-06 16:23:17 +02:00
import { find } from 'lodash'
2021-04-25 13:23:16 +03:00
import { defineAsyncComponent } from 'vue'
2026-01-08 17:26:52 +02:00
import { library } from '@fortawesome/fontawesome-svg-core'
import { faCircleNotch } from '@fortawesome/free-solid-svg-icons'
2026-01-06 16:22:52 +02:00
library.add(faCircleNotch)
const StatusPopover = {
name: 'StatusPopover',
2026-01-06 16:22:52 +02:00
props: ['statusId'],
data() {
return {
2026-01-06 16:22:52 +02:00
error: false,
}
},
2019-10-24 22:14:53 -04:00
computed: {
2026-01-06 16:22:52 +02:00
status() {
2019-10-24 22:14:53 -04:00
return find(this.$store.state.statuses.allStatuses, { id: this.statusId })
2026-01-06 16:22:52 +02:00
},
2019-10-24 22:14:53 -04:00
},
components: {
2021-04-25 13:23:16 +03:00
Status: defineAsyncComponent(() => import('../status/status.vue')),
2026-01-06 16:22:52 +02:00
Popover: defineAsyncComponent(() => import('../popover/popover.vue')),
},
methods: {
2026-01-06 16:22:52 +02:00
enter() {
2019-10-24 22:14:53 -04:00
if (!this.status) {
if (!this.statusId) {
this.error = true
return
}
2026-01-06 16:22:52 +02:00
this.$store
.dispatch('fetchStatus', this.statusId)
2025-02-04 15:23:21 +02:00
.then(() => (this.error = false))
.catch(() => (this.error = true))
}
2026-01-06 16:22:52 +02:00
},
},
watch: {
2026-01-06 16:22:52 +02:00
status(newStatus, oldStatus) {
if (newStatus !== oldStatus) {
this.$nextTick(() => this.$refs.popover.updateStyles())
}
2026-01-06 16:22:52 +02:00
},
},
}
export default StatusPopover