From 96bf4091936cc27201ae948dd4f76efc05b8f86e Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 21 Jan 2026 10:53:19 +0000 Subject: [PATCH] feat: make client tag link to NIP-89 app definition When the client tag has a third element with a valid 31990 address (NIP-89 app handler), make the client name clickable to open the app definition event. --- .../nostr/kinds/BaseEventRenderer.tsx | 34 ++++++++++++++++--- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/src/components/nostr/kinds/BaseEventRenderer.tsx b/src/components/nostr/kinds/BaseEventRenderer.tsx index 528a1d8..cb1c935 100644 --- a/src/components/nostr/kinds/BaseEventRenderer.tsx +++ b/src/components/nostr/kinds/BaseEventRenderer.tsx @@ -29,7 +29,7 @@ import { useCopy } from "@/hooks/useCopy"; import { JsonViewer } from "@/components/JsonViewer"; import { formatTimestamp } from "@/hooks/useLocale"; import { nip19 } from "nostr-tools"; -import { getTagValue } from "applesauce-core/helpers"; +import { getTagValue, parseCoordinate } from "applesauce-core/helpers"; import { getSeenRelays } from "applesauce-core/helpers/relays"; import { EventFooter } from "@/components/EventFooter"; import { cn } from "@/lib/utils"; @@ -496,7 +496,7 @@ export function BaseEventContainer({ label?: string; }; }) { - const { locale } = useGrimoire(); + const { locale, addWindow } = useGrimoire(); // Format relative time for display const relativeTime = formatTimestamp( @@ -515,8 +515,22 @@ export function BaseEventContainer({ // Use author override if provided, otherwise use event author const displayPubkey = authorOverride?.pubkey || event.pubkey; - // Get client tag if present - const clientName = getTagValue(event, "client"); + // Get client tag if present: ["client", "", "<31990:pubkey:d-tag>"] + const clientTag = event.tags.find((t) => t[0] === "client"); + const clientName = clientTag?.[1]; + const clientAddress = clientTag?.[2]; + const parsedClientAddress = clientAddress + ? parseCoordinate(clientAddress) + : null; + const clientAppPointer = + parsedClientAddress?.kind === 31990 ? parsedClientAddress : null; + + const handleClientClick = (e: React.MouseEvent) => { + if (clientAppPointer) { + e.stopPropagation(); + addWindow("open", { pointer: clientAppPointer }); + } + }; return ( @@ -532,7 +546,17 @@ export function BaseEventContainer({ {clientName && ( - via {clientName} + via{" "} + {clientAppPointer ? ( + + ) : ( + clientName + )} )}