diff --git a/src/components/EmbeddedNaddr.tsx b/src/components/EmbeddedNaddr.tsx index bfe1731e..52b1e1f8 100644 --- a/src/components/EmbeddedNaddr.tsx +++ b/src/components/EmbeddedNaddr.tsx @@ -68,7 +68,7 @@ export function EmbeddedNaddr({ addr, className }: EmbeddedNaddrProps) { } if (isError || !event) { - return ; + return ; } // For follow packs / starter packs, render the same NoteCard used in feeds (without actions) @@ -201,13 +201,38 @@ function EmbeddedNaddrCard({ event, className }: { event: NostrEvent; className? } /** Tombstone shown when an addressable event could not be loaded. */ -function EmbeddedNaddrTombstone({ className }: { className?: string }) { +function EmbeddedNaddrTombstone({ addr, className }: { addr: AddrCoords; className?: string }) { + const navigate = useNavigate(); + + const naddrId = useMemo( + () => nip19.naddrEncode({ + kind: addr.kind, + pubkey: addr.pubkey, + identifier: addr.identifier, + }), + [addr], + ); + return (
{ + e.stopPropagation(); + navigate(`/${naddrId}`); + }} + onKeyDown={(e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + e.stopPropagation(); + navigate(`/${naddrId}`); + } + }} >
diff --git a/src/components/EmbeddedNote.tsx b/src/components/EmbeddedNote.tsx index f64f2124..557e0432 100644 --- a/src/components/EmbeddedNote.tsx +++ b/src/components/EmbeddedNote.tsx @@ -88,7 +88,7 @@ export function EmbeddedNote({ eventId, relays, authorHint, className, disableHo } if (isError || !event) { - return ; + return ; } // For follow packs / lists, render the same rich NoteCard used in feeds @@ -349,13 +349,38 @@ function MaybeProfileHoverCard({ pubkey, disabled, children }: { pubkey: string; } /** Tombstone shown when a quoted note could not be loaded. */ -function EmbeddedNoteTombstone({ className }: { className?: string }) { +function EmbeddedNoteTombstone({ eventId, relays, authorHint, className }: { eventId: string; relays?: string[]; authorHint?: string; className?: string }) { + const navigate = useNavigate(); + + const neventId = useMemo( + () => nip19.neventEncode({ + id: eventId, + ...(authorHint ? { author: authorHint } : {}), + ...(relays?.length ? { relays } : {}), + }), + [eventId, authorHint, relays], + ); + return (
{ + e.stopPropagation(); + navigate(`/${neventId}`); + }} + onKeyDown={(e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + e.stopPropagation(); + navigate(`/${neventId}`); + } + }} >