1
0
mirror of https://github.com/elk-zone/elk synced 2024-12-16 15:48:00 +09:00
elk/pages/status/[status].vue
2022-11-24 16:04:53 +08:00

40 lines
1.1 KiB
Vue

<script setup lang="ts">
import type { Component } from 'vue'
const params = useRoute().params
const id = $computed(() => params.status as string)
const main = ref<Component | null>(null)
const status = await fetchStatus(id)
const { data: context } = useAsyncData(`context:${id}`, () => masto.statuses.fetchContext(id))
</script>
<template>
<template v-if="status">
<template v-if="context">
<template v-for="comment of context?.ancestors" :key="comment.id">
<StatusCard :status="comment" border="t base" py3 />
</template>
</template>
<StatusDetails ref="main" :status="status" border="t base" />
<PublishWidget
v-if="currentUser"
border="t base"
:draft-key="`reply-${id}`"
:placeholder="`Reply to ${status?.account ? getDisplayName(status?.account) : 'this thread'}`"
:in-reply-to-id="id"
/>
<template v-if="context">
<template v-for="comment of context?.descendants" :key="comment.id">
<StatusCard :status="comment" border="t base" py3 />
</template>
</template>
</template>
<CommonNotFound v-else>
Status not found
</CommonNotFound>
</template>