From aef464b8a04b69a897aa79a84ae18fa52604030e Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Jan 2026 09:56:02 +0000 Subject: [PATCH] Fix custom emoji shortcode matching to include dashes The regex pattern for matching NIP-30 custom emoji shortcodes was missing the dash character, causing emojis like :work-out: to fail matching. Updated both ReactionRenderer and ReactionCompactPreview to use [a-zA-Z0-9_-] instead of [a-zA-Z0-9_]. --- src/components/nostr/compact/ReactionCompactPreview.tsx | 2 +- src/components/nostr/kinds/ReactionRenderer.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/nostr/compact/ReactionCompactPreview.tsx b/src/components/nostr/compact/ReactionCompactPreview.tsx index c043a31..cb39993 100644 --- a/src/components/nostr/compact/ReactionCompactPreview.tsx +++ b/src/components/nostr/compact/ReactionCompactPreview.tsx @@ -26,7 +26,7 @@ export function ReactionCompactPreview({ event }: { event: NostrEvent }) { // Parse reaction content for custom emoji const parsedReaction = useMemo(() => { - const match = reaction.match(/^:([a-zA-Z0-9_]+):$/); + const match = reaction.match(/^:([a-zA-Z0-9_-]+):$/); if (match && customEmojis[match[1]]) { return { type: "custom" as const, diff --git a/src/components/nostr/kinds/ReactionRenderer.tsx b/src/components/nostr/kinds/ReactionRenderer.tsx index a04d699..25f5c37 100644 --- a/src/components/nostr/kinds/ReactionRenderer.tsx +++ b/src/components/nostr/kinds/ReactionRenderer.tsx @@ -32,7 +32,7 @@ export function Kind7Renderer({ event }: BaseEventProps) { // Parse reaction content to detect custom emoji shortcodes // Format: :shortcode: in the content const parsedReaction = useMemo(() => { - const match = reaction.match(/^:([a-zA-Z0-9_]+):$/); + const match = reaction.match(/^:([a-zA-Z0-9_-]+):$/); if (match && customEmojis[match[1]]) { return { type: "custom" as const,