2022-11-26 02:49:56 +03:00
|
|
|
<script setup lang="ts">
|
|
|
|
import type { Component } from 'vue'
|
|
|
|
|
|
|
|
const route = useRoute()
|
|
|
|
const id = $computed(() => route.params.status as string)
|
|
|
|
const main = ref<Component | null>(null)
|
|
|
|
|
|
|
|
const status = window.history.state?.status ?? await fetchStatus(id)
|
|
|
|
const { data: context } = useAsyncData(`context:${id}`, () => masto.statuses.fetchContext(id))
|
2022-11-26 18:38:55 +03:00
|
|
|
const unsubscribe = watch(context, async (context) => {
|
|
|
|
if (context) {
|
|
|
|
const statusElement = document.querySelector(`#status-${id}`)
|
|
|
|
statusElement?.scrollIntoView()
|
|
|
|
unsubscribe()
|
|
|
|
}
|
|
|
|
}, { flush: 'post' })
|
2022-11-26 02:49:56 +03:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2022-11-26 15:58:10 +03:00
|
|
|
<MainContent back>
|
2022-11-26 02:49:56 +03:00
|
|
|
<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}`"
|
2022-11-26 18:06:30 +03:00
|
|
|
:placeholder="`Reply to ${status?.account ? getDisplayName(status.account) : 'this thread'}`"
|
2022-11-26 02:49:56 +03:00
|
|
|
: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>
|
|
|
|
</template>
|