diff --git a/src/components/nostr/RichText/Gallery.tsx b/src/components/nostr/RichText/Gallery.tsx index f44797c..129871c 100644 --- a/src/components/nostr/RichText/Gallery.tsx +++ b/src/components/nostr/RichText/Gallery.tsx @@ -6,9 +6,12 @@ import { } from "applesauce-core/helpers/url"; import { MediaDialog } from "../MediaDialog"; import { MediaEmbed } from "../MediaEmbed"; -import { PlainLink } from "../LinkPreview"; import { useRichTextOptions } from "../RichText"; +function MediaPlaceholder({ type }: { type: "image" | "video" | "audio" }) { + return [{type}]; +} + interface GalleryNodeProps { node: { links?: string[]; @@ -35,13 +38,13 @@ export function Gallery({ node }: GalleryNodeProps) { if (shouldShowMedia && options.showImages) { return ; } - return ; + return ; } if (isVideoURL(url)) { if (shouldShowMedia && options.showVideos) { return ; } - return ; + return ; } if (isAudioURL(url)) { if (shouldShowMedia && options.showAudio) { @@ -53,9 +56,10 @@ export function Gallery({ node }: GalleryNodeProps) { /> ); } - return ; + return ; } - return ; + // Non-media URLs shouldn't appear in galleries, but handle gracefully + return null; }; // Only show dialog for audio files diff --git a/src/components/nostr/RichText/Link.tsx b/src/components/nostr/RichText/Link.tsx index 95302d1..3000872 100644 --- a/src/components/nostr/RichText/Link.tsx +++ b/src/components/nostr/RichText/Link.tsx @@ -9,6 +9,10 @@ import { MediaEmbed } from "../MediaEmbed"; import { PlainLink } from "../LinkPreview"; import { useRichTextOptions } from "../RichText"; +function MediaPlaceholder({ type }: { type: "image" | "video" | "audio" }) { + return [{type}]; +} + interface LinkNodeProps { node: { href: string; @@ -40,7 +44,7 @@ export function Link({ node }: LinkNodeProps) { /> ); } - return ; + return ; } if (isVideoURL(href)) { @@ -54,7 +58,7 @@ export function Link({ node }: LinkNodeProps) { /> ); } - return ; + return ; } if (isAudioURL(href)) { @@ -76,7 +80,7 @@ export function Link({ node }: LinkNodeProps) { ); } - return ; + return ; } // Plain link for non-media URLs diff --git a/src/components/nostr/RichText/Mention.tsx b/src/components/nostr/RichText/Mention.tsx index 02f0732..ea3f29c 100644 --- a/src/components/nostr/RichText/Mention.tsx +++ b/src/components/nostr/RichText/Mention.tsx @@ -3,6 +3,12 @@ import { UserName } from "../UserName"; import { EventEmbed } from "./EventEmbed"; import { EventPointer, AddressPointer } from "nostr-tools/nip19"; import { useDepth, useRichTextOptions } from "../RichText"; +import { getKindName } from "@/constants/kinds"; + +function EventPlaceholder({ kind }: { kind?: number }) { + const name = kind !== undefined ? getKindName(kind) : "event"; + return [{name}]; +} interface MentionNodeProps { node: { @@ -49,11 +55,7 @@ export function Mention({ node }: MentionNodeProps) { }; if (!options.showEventEmbeds) { - return ( - - {node.encoded || `note:${pointer.id.slice(0, 8)}...`} - - ); + return ; } return ; @@ -63,11 +65,7 @@ export function Mention({ node }: MentionNodeProps) { const pointer: EventPointer = node.decoded.data; if (!options.showEventEmbeds) { - return ( - - {node.encoded || `nevent:${pointer.id.slice(0, 8)}...`} - - ); + return ; } return ; @@ -77,12 +75,7 @@ export function Mention({ node }: MentionNodeProps) { const pointer: AddressPointer = node.decoded.data; if (!options.showEventEmbeds) { - return ( - - {node.encoded || - `naddr:${pointer.identifier || pointer.pubkey.slice(0, 8)}...`} - - ); + return ; } return ;