feat: add chat/comments action to all event types in menu

The event menu now shows a chat action for all event types:
- Kind 1 notes: Opens NIP-10 thread chat (labeled "Chat")
- All other events: Opens NIP-22 comments (labeled "Comments")

For addressable events (articles, live activities, etc.), uses address
pointer. For regular events, uses event pointer with relay hints.
This commit is contained in:
Claude
2026-01-19 16:37:24 +00:00
parent e5eab70b68
commit ecb3f41d84

View File

@@ -193,12 +193,11 @@ export function EventMenu({ event }: { event: NostrEvent }) {
};
const openChatWindow = () => {
// Only kind 1 notes support NIP-10 thread chat
if (event.kind === 1) {
const seenRelaysSet = getSeenRelays(event);
const relays = seenRelaysSet ? Array.from(seenRelaysSet) : [];
const seenRelaysSet = getSeenRelays(event);
const relays = seenRelaysSet ? Array.from(seenRelaysSet) : [];
// Open chat with NIP-10 thread protocol
// Kind 1 notes use NIP-10 thread protocol
if (event.kind === 1) {
addWindow("chat", {
protocol: "nip-10",
identifier: {
@@ -212,6 +211,40 @@ export function EventMenu({ event }: { event: NostrEvent }) {
relays,
},
});
return;
}
// All other events use NIP-22 comment protocol
if (isAddressableKind(event.kind)) {
// Addressable events use address pointer
const dTag = getTagValue(event, "d") || "";
addWindow("chat", {
protocol: "nip-22",
identifier: {
type: "comment",
value: {
kind: event.kind,
pubkey: event.pubkey,
identifier: dTag,
},
relays,
},
});
} else {
// Regular events use event pointer
addWindow("chat", {
protocol: "nip-22",
identifier: {
type: "comment",
value: {
id: event.id,
relays,
author: event.pubkey,
kind: event.kind,
},
relays,
},
});
}
};
@@ -243,12 +276,10 @@ export function EventMenu({ event }: { event: NostrEvent }) {
<Zap className="size-4 mr-2 text-yellow-500" />
Zap
</DropdownMenuItem>
{event.kind === 1 && (
<DropdownMenuItem onClick={openChatWindow}>
<MessageSquare className="size-4 mr-2" />
Chat
</DropdownMenuItem>
)}
<DropdownMenuItem onClick={openChatWindow}>
<MessageSquare className="size-4 mr-2" />
{event.kind === 1 ? "Chat" : "Comments"}
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem onClick={copyEventId}>
{copied ? (