fyne-on/pages/@[user]/[post].vue

42 lines
1.3 KiB
Vue
Raw Normal View History

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