diff --git a/src/components/EmbeddedNote.tsx b/src/components/EmbeddedNote.tsx index d865d447..1ed5f6b9 100644 --- a/src/components/EmbeddedNote.tsx +++ b/src/components/EmbeddedNote.tsx @@ -61,6 +61,10 @@ function parseEmbedSegments(text: string): EmbedSegment[] { interface EmbeddedNoteProps { /** Hex event ID to fetch and display. */ eventId: string; + /** Optional relay hints from the nevent1 identifier. */ + relays?: string[]; + /** Optional author pubkey hint from the nevent1 identifier. */ + authorHint?: string; className?: string; /** When true, ProfileHoverCards inside the card are disabled to prevent nested hover cards. */ disableHoverCards?: boolean; @@ -70,8 +74,8 @@ interface EmbeddedNoteProps { const MAX_CONTENT_LENGTH = 280; /** Inline embedded note card – similar to a link preview but for Nostr events. */ -export function EmbeddedNote({ eventId, className, disableHoverCards }: EmbeddedNoteProps) { - const { data: event, isLoading, isError } = useEvent(eventId); +export function EmbeddedNote({ eventId, relays, authorHint, className, disableHoverCards }: EmbeddedNoteProps) { + const { data: event, isLoading, isError } = useEvent(eventId, relays, authorHint); if (isLoading) { return ; diff --git a/src/components/NoteContent.tsx b/src/components/NoteContent.tsx index f4d11f1d..5888600f 100644 --- a/src/components/NoteContent.tsx +++ b/src/components/NoteContent.tsx @@ -152,7 +152,7 @@ type ContentToken = | { type: 'inline-link'; url: string } | { type: 'youtube-embed'; videoId: string } | { type: 'mention'; pubkey: string } - | { type: 'nevent-embed'; eventId: string } + | { type: 'nevent-embed'; eventId: string; relays?: string[]; author?: string } | { type: 'naddr-embed'; addr: AddrCoords; url?: string } | { type: 'nostr-link'; id: string; raw: string } | { type: 'hashtag'; tag: string; raw: string }; @@ -296,7 +296,12 @@ export function NoteContent({ } else if (decoded.type === 'note') { result.push({ type: 'nevent-embed', eventId: decoded.data as string }); } else if (decoded.type === 'nevent') { - result.push({ type: 'nevent-embed', eventId: (decoded.data as { id: string }).id }); + result.push({ + type: 'nevent-embed', + eventId: decoded.data.id, + relays: decoded.data.relays, + author: decoded.data.author, + }); } else if (decoded.type === 'naddr') { result.push({ type: 'naddr-embed', addr: decoded.data as AddrCoords }); } else { @@ -446,7 +451,7 @@ export function NoteContent({ case 'youtube-embed': return ; case 'nevent-embed': - return ; + return ; case 'naddr-embed': return (