feat: status route using full account (#115)
This commit is contained in:
parent
b36a803eef
commit
4bb2910761
9 changed files with 104 additions and 81 deletions
|
@ -1,41 +1,19 @@
|
|||
<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))
|
||||
definePageMeta({
|
||||
middleware: async (to) => {
|
||||
const params = to.params
|
||||
const id = params.status as string
|
||||
const status = await fetchStatus(id)
|
||||
return {
|
||||
path: getStatusPath(status),
|
||||
state: {
|
||||
status,
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<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>
|
||||
</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>
|
||||
</MainContent>
|
||||
<div />
|
||||
</template>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue