2022-11-26 14:05:44 +09:00
|
|
|
<script setup lang="ts">
|
|
|
|
import type { Status, StatusEdit } from 'masto'
|
2022-12-28 03:00:42 +09:00
|
|
|
import { formatTimeAgo } from '@vueuse/core'
|
2022-11-26 14:05:44 +09:00
|
|
|
|
|
|
|
const { status } = defineProps<{
|
|
|
|
status: Status
|
|
|
|
}>()
|
|
|
|
|
2022-12-25 23:04:50 +09:00
|
|
|
const masto = useMasto()
|
|
|
|
const { data: statusEdits } = useAsyncData(`status:history:${status.id}`, () => masto.statuses.fetchHistory(status.id).then(res => res.reverse()))
|
2022-11-26 14:05:44 +09:00
|
|
|
|
|
|
|
const showHistory = (edit: StatusEdit) => {
|
|
|
|
openEditHistoryDialog(edit)
|
|
|
|
}
|
2022-12-02 11:18:36 +09:00
|
|
|
const timeAgoOptions = useTimeAgoOptions()
|
2022-11-26 14:05:44 +09:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<template v-if="statusEdits">
|
|
|
|
<CommonDropdownItem
|
|
|
|
v-for="(edit, idx) in statusEdits"
|
|
|
|
:key="idx"
|
|
|
|
px="0.5"
|
|
|
|
@click="showHistory(edit)"
|
|
|
|
>
|
|
|
|
{{ getDisplayName(edit.account) }}
|
2022-12-28 03:00:42 +09:00
|
|
|
|
|
|
|
<template v-if="idx === statusEdits.length - 1">
|
|
|
|
<i18n-t keypath="status_history.created">
|
|
|
|
{{ formatTimeAgo(new Date(edit.createdAt), timeAgoOptions) }}
|
|
|
|
</i18n-t>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
<i18n-t keypath="status_history.edited">
|
|
|
|
{{ formatTimeAgo(new Date(edit.createdAt), timeAgoOptions) }}
|
|
|
|
</i18n-t>
|
|
|
|
</template>
|
2022-11-26 14:05:44 +09:00
|
|
|
</CommonDropdownItem>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
<div i-ri:loader-2-fill animate-spin text-2xl ma />
|
|
|
|
</template>
|
|
|
|
</template>
|