import type { NostrEvent } from '@nostrify/nostrify'; import { VideoPlayer } from '@/components/VideoPlayer'; import { AudioVisualizer } from '@/components/AudioVisualizer'; import { WebxdcEmbed } from '@/components/WebxdcEmbed'; import { useAuthor } from '@/hooks/useAuthor'; import { getDisplayName } from '@/lib/getDisplayName'; import { genUserName } from '@/lib/genUserName'; import type { ImetaEntry } from '@/lib/imeta'; /** Media content for kind 1 text notes — renders videos, audio, and webxdc apps. */ export function NoteMedia({ videos, audios = [], imetaMap, webxdcApps = [], event, }: { videos: string[]; audios?: string[]; imetaMap: Map; webxdcApps?: ImetaEntry[]; event: NostrEvent; }) { const author = useAuthor(event.pubkey); const metadata = author.data?.metadata; const displayName = getDisplayName(metadata, event.pubkey) ?? genUserName(event.pubkey); if (videos.length === 0 && audios.length === 0 && webxdcApps.length === 0) return null; return ( <> {/* Videos — each rendered with play/pause overlay */} {videos.map((url, i) => ( ))} {/* Audio — rendered as visualizer with avatar */} {audios.map((url, i) => { const mime = imetaMap.get(url)?.mime; return ( ); })} {/* Webxdc apps */} {webxdcApps.map((app) => ( ))} ); }