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}

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