parent
c2f3526e88
commit
9fca8eee30
6 changed files with 85 additions and 53 deletions
|
@ -1,4 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import type { Status } from 'masto'
|
||||
import type { ComponentPublicInstance } from 'vue'
|
||||
|
||||
const route = useRoute()
|
||||
|
@ -6,9 +7,14 @@ const id = $(computedEager(() => route.params.status as string))
|
|||
const main = ref<ComponentPublicInstance | null>(null)
|
||||
let bottomSpace = $ref(0)
|
||||
|
||||
const { data: status, refresh: refreshStatus } = useAsyncData(async () => window.history.state?.status ?? await fetchStatus(id))
|
||||
const { data: status, refresh: refreshStatus } = useAsyncData(async () => (
|
||||
window.history.state?.status as Status | undefined)
|
||||
?? await fetchStatus(id),
|
||||
)
|
||||
const { data: context, pending, refresh: refreshContext } = useAsyncData(`context:${id}`, () => useMasto().statuses.fetchContext(id))
|
||||
|
||||
const replyDraft = $computed(() => status.value ? getReplyDraft(status.value) : null)
|
||||
|
||||
function scrollTo() {
|
||||
const statusElement = unrefElement(main)
|
||||
if (!statusElement)
|
||||
|
@ -53,11 +59,9 @@ onReactivated(() => {
|
|||
/>
|
||||
<PublishWidget
|
||||
v-if="currentUser"
|
||||
:draft-key="replyDraft!.key"
|
||||
:initial="replyDraft!.draft"
|
||||
border="t base"
|
||||
:draft-key="`reply-${id}`"
|
||||
:placeholder="`Reply to ${status?.account ? getDisplayName(status.account) : 'this thread'}`"
|
||||
:in-reply-to-id="id"
|
||||
:in-reply-to-visibility="status.visibility"
|
||||
/>
|
||||
|
||||
<template v-if="context">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue