From 58bdb3216ffaf594d08bc493c5cabd8f6a039cd7 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 20 Jan 2026 11:49:02 +0000 Subject: [PATCH] feat: improve NIP-17 chat UX and inbox functionality - Remove "load older messages" button from NIP-17 chats (messages stored locally) - Show "Saved Messages" for self-conversations, UserName for others - Hide member list dropdown for self-conversations - Fix inbox item click to properly open NIP-17 chat using addWindow() - Add lock icon to NIP-17 heading indicating end-to-end encryption - Add InboxRelaysDropdown showing participants' NIP-10050 relays - Replace RelaysDropdown with InboxRelaysDropdown for NIP-17 conversations --- src/components/ChatViewer.tsx | 57 ++++++- src/components/InboxViewer.tsx | 17 +- src/components/chat/InboxRelaysDropdown.tsx | 165 ++++++++++++++++++++ 3 files changed, 227 insertions(+), 12 deletions(-) create mode 100644 src/components/chat/InboxRelaysDropdown.tsx diff --git a/src/components/ChatViewer.tsx b/src/components/ChatViewer.tsx index 473685e..387cfe9 100644 --- a/src/components/ChatViewer.tsx +++ b/src/components/ChatViewer.tsx @@ -12,6 +12,7 @@ import { Copy, CopyCheck, FileText, + Lock, } from "lucide-react"; import { nip19 } from "nostr-tools"; import { getZapRequest } from "applesauce-common/helpers/zap"; @@ -39,6 +40,7 @@ import Timestamp from "./Timestamp"; import { ReplyPreview } from "./chat/ReplyPreview"; import { MembersDropdown } from "./chat/MembersDropdown"; import { RelaysDropdown } from "./chat/RelaysDropdown"; +import { InboxRelaysDropdown } from "./chat/InboxRelaysDropdown"; import { MessageReactions } from "./chat/MessageReactions"; import { StatusBadge } from "./live/StatusBadge"; import { ChatMessageContextMenu } from "./chat/ChatMessageContextMenu"; @@ -871,7 +873,33 @@ export function ChatViewer({ className="text-sm font-semibold truncate cursor-help text-left" onClick={() => setTooltipOpen(!tooltipOpen)} > - {customTitle || conversation.title} + {customTitle || + (() => { + // For NIP-17, show "Saved Messages" or participant name + if ( + protocol === "nip-17" && + conversation.participants.length === 2 + ) { + const [p1, p2] = conversation.participants; + const isSelfConversation = p1.pubkey === p2.pubkey; + + if (isSelfConversation) { + return "Saved Messages"; + } + + // Show the other participant's name + const otherPubkey = + p1.pubkey === pubkey ? p2.pubkey : p1.pubkey; + return ( + + ); + } + + return conversation.title; + })()}
- - + {/* Hide member list for self-conversations (Saved Messages) */} + {!( + protocol === "nip-17" && + conversation.participants.length === 2 && + conversation.participants[0].pubkey === + conversation.participants[1].pubkey + ) && } + {/* Show inbox relays for NIP-17, regular relays for other protocols */} + {protocol === "nip-17" ? ( + + ) : ( + + )} + {/* Show lock icon for encrypted conversations */} + {protocol === "nip-17" && ( +
+ +
+ )} + + +
+
+ Inbox Relays (NIP-10050) +
+
+
+ {participantRelays.map(({ pubkey, relays }) => ( +
+
+ +
+
+ {relays.map((relay) => { + const state = relayStates[relay]; + const connIcon = getConnectionIcon(state); + const authIcon = getAuthIcon(state); + + return ( +
+
+ +
+
+ + +
{connIcon.icon}
+
+ +

{connIcon.label}

+
+
+ + +
{authIcon.icon}
+
+ +

{authIcon.label}

+
+
+
+
+ ); + })} +
+
+ ))} +
+
+ + ); +}