1
0
mirror of https://github.com/elk-zone/elk synced 2024-12-17 08:08:00 +09:00
elk/pages/@[user]/[post].vue

38 lines
1.2 KiB
Vue
Raw Normal View History

2022-11-14 01:05:32 +09:00
<script setup lang="ts">
import AccountAvatar from '~~/components/account/AccountAvatar.vue'
2022-11-14 01:05:32 +09:00
const params = useRoute().params
2022-11-14 23:54:30 +09:00
const id = computed(() => params.post as string)
2022-11-14 12:33:09 +09:00
2022-11-14 23:54:30 +09:00
const { data: status } = await useAsyncData(`${id}-status`, () => masto.statuses.fetch(params.post as string))
const { data: context } = await useAsyncData(`${id}-context`, () => masto.statuses.fetchContext(params.post as string))
2022-11-14 01:05:32 +09:00
</script>
<template>
2022-11-21 22:21:53 +09:00
<template v-if="status">
<template v-for="comment of context?.ancestors" :key="comment.id">
2022-11-23 11:16:31 +09:00
<StatusCard :status="comment" border="t base" pt-4 />
2022-11-21 22:21:53 +09:00
</template>
2022-11-23 11:16:31 +09:00
<StatusDetails :status="status" border="t base" pt-4 />
<div v-if="currentUser" border="t base" p6 flex gap-4>
<AccountAvatar :account="currentUser.account" w-10 h-10 />
2022-11-21 22:21:53 +09:00
<PublishWidget
w-full
:draft-key="`reply-${id}`"
:placeholder="`Reply to ${status?.account ? getDisplayName(status?.account) : 'this thread'}`"
2022-11-21 22:21:53 +09:00
:in-reply-to-id="id"
/>
</div>
<template v-for="comment of context?.descendants" :key="comment.id">
2022-11-23 11:16:31 +09:00
<StatusCard :status="comment" border="t base" pt-4 />
2022-11-21 22:21:53 +09:00
</template>
2022-11-18 18:37:22 +09:00
</template>
2022-11-21 15:55:31 +09:00
2022-11-21 22:21:53 +09:00
<template>
<div>
Status not found
</div>
2022-11-14 23:54:30 +09:00
</template>
2022-11-14 01:05:32 +09:00
</template>