ui: show host first in members list, all relays in dropdown

- derivedParticipants now puts host first with 'host' role
- Other participants from messages follow as 'member'
- RelaysDropdown shows all NIP-53 liveActivity.relays
This commit is contained in:
Claude
2026-01-12 11:51:50 +00:00
parent 86b41f7504
commit cdbc888ea3
2 changed files with 31 additions and 11 deletions

View File

@@ -399,18 +399,31 @@ export function ChatViewer({
if (conversation?.type !== "live-chat" || !messages) {
return conversation?.participants || [];
}
// Get unique pubkeys from messages
const pubkeys = new Set<string>();
const hostPubkey = liveActivity?.hostPubkey;
const participants: { pubkey: string; role: "host" | "member" }[] = [];
// Host always first
if (hostPubkey) {
participants.push({ pubkey: hostPubkey, role: "host" });
}
// Add other participants from messages (excluding host)
const seen = new Set(hostPubkey ? [hostPubkey] : []);
for (const msg of messages) {
if (msg.type !== "system") {
pubkeys.add(msg.author);
if (msg.type !== "system" && !seen.has(msg.author)) {
seen.add(msg.author);
participants.push({ pubkey: msg.author, role: "member" });
}
}
return Array.from(pubkeys).map((pubkey) => ({
pubkey,
role: "member" as const,
}));
}, [conversation?.type, conversation?.participants, messages]);
return participants;
}, [
conversation?.type,
conversation?.participants,
messages,
liveActivity?.hostPubkey,
]);
if (!conversation) {
return (

View File

@@ -24,8 +24,15 @@ export function RelaysDropdown({ conversation }: RelaysDropdownProps) {
// Get relays for this conversation
const relays: string[] = [];
// NIP-29: Single group relay
if (conversation.metadata?.relayUrl) {
// NIP-53: Multiple relays from liveActivity
const liveActivityRelays = conversation.metadata?.liveActivity?.relays as
| string[]
| undefined;
if (liveActivityRelays?.length) {
relays.push(...liveActivityRelays);
}
// NIP-29: Single group relay (fallback)
else if (conversation.metadata?.relayUrl) {
relays.push(conversation.metadata.relayUrl);
}