feat(status): edit history

This commit is contained in:
三咲智子 2022-11-26 13:05:44 +08:00
parent eb3f2ab771
commit 36fc189064
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E
11 changed files with 152 additions and 59 deletions

View file

@ -0,0 +1,31 @@
<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>