import { useLiveThread } from "@app/space/hooks/useLiveThread"; import { getNoteByID, removeBlock } from "@libs/storage"; import { Kind1 } from "@shared/notes/contents/kind1"; import { Kind1063 } from "@shared/notes/contents/kind1063"; import { NoteMetadata } from "@shared/notes/metadata"; import { NoteReplyForm } from "@shared/notes/replies/form"; import { RepliesList } from "@shared/notes/replies/list"; import { NoteSkeleton } from "@shared/notes/skeleton"; import { TitleBar } from "@shared/titleBar"; import { User } from "@shared/user"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { useAccount } from "@utils/hooks/useAccount"; import { parser } from "@utils/parser"; export function ThreadBlock({ params }: { params: any }) { useLiveThread(params.content); const queryClient = useQueryClient(); const { account } = useAccount(); const { status, data } = useQuery(["thread", params.content], async () => { const res = await getNoteByID(params.content); res["content"] = parser(res); return res; }); const block = useMutation({ mutationFn: (id: string) => { return removeBlock(id); }, onSuccess: () => { queryClient.invalidateQueries({ queryKey: ["blocks"] }); }, }); return (
block.mutate(params.id)} />
{status === "loading" ? (
) : (
{data.kind === 1 && } {data.kind === 1063 && }
{account && ( )}
)}
); }