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

49 lines
1 KiB
JavaScript
Raw Normal View History

2026-06-02 18:09:12 +03:00
import Popover from 'src/components/popover/popover.vue'
2026-08-10 22:26:22 +03:00
import { useStatusesStore } from 'src/stores/statuses.js'
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() {
2026-08-10 22:26:22 +03:00
return useStatusesStore().allStatuses.get(this.statusId)
2026-01-06 16:22:52 +02:00
},
2019-10-24 22:14:53 -04:00
},
components: {
2026-06-02 18:09:12 +03:00
Popover,
},
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-08-10 22:26:22 +03:00
useStatusesStore()
.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