import { RepostIcon } from "@lume/icons"; import { Event } from "@lume/types"; import { cn } from "@lume/utils"; import { useQuery } from "@tanstack/react-query"; import { useTranslation } from "react-i18next"; import { Note } from ".."; import { User } from "../../user"; import { useArk } from "@lume/ark"; export function RepostNote({ event, className, }: { event: Event; className?: string; }) { const ark = useArk(); const { t } = useTranslation(); const { isLoading, isError, data: repostEvent, } = useQuery({ queryKey: ["repost", event.id], queryFn: async () => { try { if (event.content.length > 50) { const embed = JSON.parse(event.content) as Event; return embed; } const id = event.tags.find((el) => el[0] === "e")[1]; return await ark.get_event(id); } catch { throw new Error("Failed to get repost event"); } }, refetchOnWindowFocus: false, refetchOnMount: false, refetchOnReconnect: false, }); if (isLoading) { return
Failed to get event