elk/pages/status/[status].vue

42 lines
1.2 KiB
Vue
Raw Normal View History

2022-11-13 19:05:32 +03:00
<script setup lang="ts">
2022-11-24 07:02:18 +03:00
import type { Component } from 'vue'
2022-11-13 19:05:32 +03:00
const params = useRoute().params
2022-11-24 08:47:14 +03:00
const id = $computed(() => params.status as string)
2022-11-24 07:02:18 +03:00
const main = ref<Component | null>(null)
2022-11-14 06:33:09 +03:00
2022-11-24 08:47:14 +03:00
const status = await fetchStatus(id)
const { data: context } = useAsyncData(`context:${id}`, () => masto.statuses.fetchContext(id))
2022-11-13 19:05:32 +03:00
</script>
<template>
2022-11-24 11:07:51 +03:00
<MainContent>
<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>
2022-11-24 07:02:18 +03:00
</template>
2022-11-24 11:07:51 +03:00
<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"
/>
2022-11-21 16:21:53 +03:00
2022-11-24 11:07:51 +03:00
<template v-if="context">
<template v-for="comment of context?.descendants" :key="comment.id">
<StatusCard :status="comment" border="t base" py3 />
</template>
2022-11-24 07:02:18 +03:00
</template>
2022-11-21 16:21:53 +03:00
</template>
2022-11-21 09:55:31 +03:00
2022-11-24 11:07:51 +03:00
<CommonNotFound v-else>
Status not found
</CommonNotFound>
</MainContent>
2022-11-13 19:05:32 +03:00
</template>