1
0
mirror of https://github.com/elk-zone/elk synced 2024-12-15 15:18:00 +09:00
elk/components/status/edit/StatusEditHistory.vue

32 lines
860 B
Vue
Raw Normal View History

2022-11-26 14:05:44 +09:00
<script setup lang="ts">
import type { Status, StatusEdit } from 'masto'
const { status } = defineProps<{
status: Status
}>()
const { data: statusEdits } = useAsyncData(`status:history:${status.id}`, () => masto.statuses.fetchHistory(status.id).then(res => res.reverse()))
const showHistory = (edit: StatusEdit) => {
openEditHistoryDialog(edit)
}
</script>
<template>
<template v-if="statusEdits">
<CommonDropdownItem
v-for="(edit, idx) in statusEdits"
:key="idx"
px="0.5"
@click="showHistory(edit)"
>
{{ getDisplayName(edit.account) }}
{{ idx === statusEdits.length - 1 ? 'created' : 'edited' }}
{{ useTimeAgo(edit.createdAt, { showSecond: true }).value }}
</CommonDropdownItem>
</template>
<template v-else>
<div i-ri:loader-2-fill animate-spin text-2xl ma />
</template>
</template>