import "./collapsible.css"; import type { ReactNode } from "react"; import { useState } from "react"; import { FormattedMessage } from "react-intl"; import * as Dialog from "@radix-ui/react-dialog"; import * as Collapsible from "@radix-ui/react-collapsible"; import type { NostrLink } from "@snort/system"; import { Mention } from "./mention"; import { EventIcon, NostrEvent } from "./Event"; import { ExternalLink } from "./external-link"; import AsyncButton from "./async-button"; import { useEventFeed } from "@snort/system-react"; interface MediaURLProps { url: URL; children: ReactNode; } export function MediaURL({ url, children }: MediaURLProps) { const preview = {url.toString()}; return ( {preview} {url.toString()} {children} ); } export function CollapsibleEvent({ link }: { link: NostrLink }) { const event = useEventFeed(link); const [open, setOpen] = useState(false); const author = event?.pubkey || link.author; return ( {event && } {author && } {open ? ( ) : ( )} {open && event && } ); }