import "./collapsible.css"; import type { ReactNode } from "react"; import { useState } from "react"; import { FormattedMessage } from "react-intl"; import type { NostrLink } from "@snort/system"; import { Mention } from "./mention"; import { EventIcon, NostrEvent } from "./event-embed"; import { ExternalLink } from "./external-link"; import { useEventFeed } from "@snort/system-react"; import Modal from "./modal"; import { DefaultButton } from "./buttons"; interface MediaURLProps { url: URL; children: ReactNode; } export function MediaURL({ url, children }: MediaURLProps) { const [open, setOpen] = useState(false); return ( <> setOpen(true)}>{url.toString()} {open && ( setOpen(false)}> {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 ( <>
, }} />
setOpen(s => !s)}> {open ? ( ) : ( )}
{open && event && } ); }