fix: always show chat button in CommunikeyViewer, fix chat props

This commit is contained in:
Claude
2026-01-12 12:58:25 +00:00
parent 45b17b9ccf
commit 6fbb3d055a

View File

@@ -109,16 +109,20 @@ export function CommunikeyViewer({ pubkey, relays }: CommunikeyViewerProps) {
: undefined;
const tos = communityEvent ? getCommunikeyTos(communityEvent) : undefined;
// Check if chat is supported (kind 9 in any section)
const hasChat = contentSections.some((section) => section.kinds.includes(9));
// Generate npub for copying
const npub = resolvedPubkey ? nip19.npubEncode(resolvedPubkey) : "";
// Open chat for this community
const openChat = () => {
if (resolvedPubkey) {
addWindow("chat", { identifier: npub });
addWindow("chat", {
protocol: "communikeys",
identifier: {
type: "communikey",
value: resolvedPubkey,
relays: communityRelays,
},
});
}
};
@@ -209,12 +213,10 @@ export function CommunikeyViewer({ pubkey, relays }: CommunikeyViewerProps) {
</div>
</div>
{hasChat && (
<Button onClick={openChat} className="gap-2">
<MessageCircle className="size-4" />
Open Chat
</Button>
)}
<Button onClick={openChat} className="gap-2">
<MessageCircle className="size-4" />
Open Chat
</Button>
</div>
{/* Description */}