+ {/* Description */}
+
+ {senderName} sent a direct message
+
- {/* Animated transit path */}
-
- {/* Dotted line */}
-
+
+ {/* Sender */}
+
- {/* Mail icon in the center */}
-
-
-
-
+ {/* Transit path */}
+
+ {/* Dotted line */}
+
+
+ {/* Mail icon in the center */}
+
-
- {/* Recipient */}
-
-
- {/* Footer with encryption badge */}
-
-
-
- Encrypted with {encryptionType}
-
+ {/* Recipient */}
+
);
}
+
+interface EncryptedMessageCompactProps {
+ event: { id: string; kind: number; pubkey: string; content: string; created_at: number; tags: string[][] };
+ className?: string;
+}
+
+/**
+ * Compact inline card for kind 4 events used in quote posts, reply indicators,
+ * and the reply composer. Matches the style of EmbeddedNoteCard.
+ */
+export function EncryptedMessageCompact({ event, className }: EncryptedMessageCompactProps) {
+ const navigate = useNavigate();
+ const author = useAuthor(event.pubkey);
+ const metadata = author.data?.metadata;
+ const avatarShape = getAvatarShape(metadata);
+ const displayName = metadata?.name || genUserName(event.pubkey);
+ const recipientPubkey = event.tags.find(([n]) => n === 'p')?.[1];
+ const recipientAuthor = useAuthor(recipientPubkey ?? '');
+ const recipientName = recipientPubkey
+ ? getDisplayName(recipientAuthor.data?.metadata, recipientPubkey)
+ : undefined;
+
+ const neventId = useMemo(
+ () => nip19.neventEncode({ id: event.id, author: event.pubkey }),
+ [event.id, event.pubkey],
+ );
+
+ const profileUrl = useProfileUrl(event.pubkey, metadata);
+
+ return (
+
{
+ e.stopPropagation();
+ navigate(`/${neventId}`);
+ }}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter' || e.key === ' ') {
+ e.preventDefault();
+ e.stopPropagation();
+ navigate(`/${neventId}`);
+ }
+ }}
+ >
+
+ {/* Author row */}
+
+ {author.isLoading ? (
+ <>
+
+
+ >
+ ) : (
+ <>
+
+ e.stopPropagation()}
+ >
+
+
+
+ {displayName[0]?.toUpperCase()}
+
+
+
+
+
+
+ e.stopPropagation()}
+ >
+ {displayName}
+
+
+ >
+ )}
+
+
+ ยท {timeAgo(event.created_at)}
+
+
+
+ {/* Content line */}
+
+
+
+ Sent a direct message{recipientName ? <> to {recipientName}> : ''}
+
+
+
+
+ );
+}