From 92af2954769a447eea477bccebe32e7dc5d39a37 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 28 Feb 2026 17:20:05 -0600 Subject: [PATCH] Show 'Commenting on @Name' for wall comments instead of 'a post' --- src/components/CommentContext.tsx | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/components/CommentContext.tsx b/src/components/CommentContext.tsx index f2afa03b..aee6f8c8 100644 --- a/src/components/CommentContext.tsx +++ b/src/components/CommentContext.tsx @@ -7,6 +7,8 @@ import { EmbeddedNote } from '@/components/EmbeddedNote'; import { HoverCard, HoverCardContent, HoverCardTrigger } from '@/components/ui/hover-card'; import { Skeleton } from '@/components/ui/skeleton'; import { useAddrEvent, useEvent } from '@/hooks/useEvent'; +import { useAuthor } from '@/hooks/useAuthor'; +import { genUserName } from '@/lib/genUserName'; import { EXTRA_KINDS } from '@/lib/extraKinds'; /** Parsed root reference from a kind 1111 comment's uppercase tags. */ @@ -131,6 +133,46 @@ export function CommentContext({ event, className }: CommentContextProps) { /** Comment context for addressable event roots (A tag). */ function AddrCommentContext({ root, className }: { root: CommentRoot; className?: string }) { + // Kind 0 (profile) roots get special treatment — show "@DisplayName" with a profile link + if (root.addr?.kind === 0) { + return ; + } + + return ; +} + +/** Comment context for kind 0 (profile) roots — shows "Commenting on @Name". */ +function ProfileCommentContext({ pubkey, className }: { pubkey: string; className?: string }) { + const author = useAuthor(pubkey); + const metadata = author.data?.metadata; + const displayName = metadata?.name ?? genUserName(pubkey); + const npubEncoded = useMemo(() => nip19.npubEncode(pubkey), [pubkey]); + + if (author.isLoading) { + return ( +
+ Commenting on + +
+ ); + } + + return ( +
+ Commenting on + e.stopPropagation()} + > + @{displayName} + +
+ ); +} + +/** Comment context for non-profile addressable event roots (A tag). */ +function GenericAddrCommentContext({ root, className }: { root: CommentRoot; className?: string }) { const { data: event, isLoading } = useAddrEvent(root.addr); if (isLoading) {