1
0
elk/pages/status/[status].vue

39 lines
1.1 KiB
Vue
Raw Normal View History

2022-11-14 01:05:32 +09:00
<script setup lang="ts">
2022-11-24 13:02:18 +09:00
import type { Component } from 'vue'
2022-11-14 01:05:32 +09:00
const params = useRoute().params
2022-11-24 14:47:14 +09:00
const id = $computed(() => params.status as string)
2022-11-24 13:02:18 +09:00
const main = ref<Component | null>(null)
2022-11-14 12:33:09 +09:00
2022-11-24 14:47:14 +09:00
const status = await fetchStatus(id)
const { data: context } = useAsyncData(`context:${id}`, () => masto.statuses.fetchContext(id))
2022-11-14 01:05:32 +09:00
</script>
<template>
2022-11-21 22:21:53 +09:00
<template v-if="status">
2022-11-24 13:02:18 +09:00
<template v-if="context">
<template v-for="comment of context?.ancestors" :key="comment.id">
2022-11-24 14:47:14 +09:00
<StatusCard :status="comment" border="t base" py3 />
2022-11-24 13:02:18 +09:00
</template>
2022-11-21 22:21:53 +09:00
</template>
2022-11-24 13:02:18 +09:00
2022-11-24 14:47:14 +09:00
<StatusDetails ref="main" :status="status" border="t base" />
2022-11-24 16:53:27 +09:00
<PublishWidget
v-if="currentUser"
:draft-key="`reply-${id}`"
:placeholder="`Reply to ${status?.account ? getDisplayName(status?.account) : 'this thread'}`"
:in-reply-to-id="id"
/>
2022-11-21 22:21:53 +09:00
2022-11-24 13:02:18 +09:00
<template v-if="context">
<template v-for="comment of context?.descendants" :key="comment.id">
2022-11-24 14:47:14 +09:00
<StatusCard :status="comment" border="t base" py3 />
2022-11-24 13:02:18 +09:00
</template>
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-24 02:16:10 +09:00
<CommonNotFound v-else>
Status not found
</CommonNotFound>
2022-11-14 01:05:32 +09:00
</template>