diff --git a/src/components/ReqViewer.tsx b/src/components/ReqViewer.tsx index d401a7f..7fb09f3 100644 --- a/src/components/ReqViewer.tsx +++ b/src/components/ReqViewer.tsx @@ -977,13 +977,12 @@ export default function ReqViewer({ align="end" className="w-80 max-h-96 overflow-y-auto" > - {/* Relay Status (condensed: connection + subscription + NIP-65) */} - {!relays && reasoning && reasoning.length > 0 ? ( - /* NIP-65 Relay Selection with status */ -
-
- Relay Selection - {isOptimized && ( + {/* Relay Status - shows ALL queried relays (outbox + fallback or explicit) */} +
+
+ {!relays && isOptimized ? ( + <> + Relay Selection{" "} (
+ + ) : ( + "Relay Status" + )} +
- {/* Relay list with connection, subscription, and NIP-65 info */} -
- {reasoning.map((r, i) => { - const globalState = relayStates[r.relay]; - const reqState = reqRelayStates.get(r.relay); - const connIcon = getConnectionIcon(globalState); - const authIcon = getAuthIcon(globalState); - const badge = reqState - ? getRelayStateBadge(reqState) - : null; + {/* Always show ALL relays from finalRelays (what's actually queried) */} +
+ {finalRelays.map((url) => { + const globalState = relayStates[url]; + const reqState = reqRelayStates.get(url); + const connIcon = getConnectionIcon(globalState); + const authIcon = getAuthIcon(globalState); + const badge = reqState + ? getRelayStateBadge(reqState) + : null; - return ( -
- -
- {/* Event count */} - {reqState && reqState.eventCount > 0 && ( - - -
- - - {reqState.eventCount} - -
-
- - {reqState.eventCount} events received - -
- )} + // Find NIP-65 info for this relay (if using outbox) + const nip65Info = reasoning?.find((r) => r.relay === url); - {/* Subscription state badge */} - {badge && ( - - {badge.text} - - )} - - {/* NIP-65 inbox/outbox indicators */} - {r.readers.length > 0 && ( - - -
- - - {r.readers.length} - -
-
- - Inbox relay for {r.readers.length} author - {r.readers.length !== 1 ? "s" : ""} - -
- )} - {r.writers.length > 0 && ( - - -
- - - {r.writers.length} - -
-
- - Outbox relay for {r.writers.length} author - {r.writers.length !== 1 ? "s" : ""} - -
- )} - - {/* Fallback indicator */} - {r.isFallback && ( - - fallback - - )} - - {/* Auth icon */} - {authIcon && ( - - -
- {authIcon.icon} -
-
- -

{authIcon.label}

-
-
- )} - - {/* Connection icon */} + return ( +
+ +
+ {/* Event count */} + {reqState && reqState.eventCount > 0 && ( -
- {connIcon.icon} +
+ + + {reqState.eventCount} +
-

{connIcon.label}

+ {reqState.eventCount} events received
-
-
- ); - })} -
-
- ) : ( - /* Explicit relays: show simple status list */ -
-
- Relay Status -
-
- {finalRelays.map((url) => { - const globalState = relayStates[url]; - const reqState = reqRelayStates.get(url); - const connIcon = getConnectionIcon(globalState); - const authIcon = getAuthIcon(globalState); - const badge = reqState - ? getRelayStateBadge(reqState) - : null; + )} - return ( -
- -
- {/* Event count */} - {reqState && reqState.eventCount > 0 && ( - - -
- - - {reqState.eventCount} - -
-
- - {reqState.eventCount} events received - -
- )} + {/* Subscription state badge */} + {badge && ( + + {badge.text} + + )} - {/* Subscription state badge */} - {badge && ( - - {badge.text} - - )} - - {/* Auth icon */} - {authIcon && ( - - -
- {authIcon.icon} -
-
- -

{authIcon.label}

-
-
- )} - - {/* Connection icon */} + {/* NIP-65 inbox/outbox indicators (if available) */} + {nip65Info && nip65Info.readers.length > 0 && ( -
- {connIcon.icon} +
+ + + {nip65Info.readers.length} +
-

{connIcon.label}

+ Inbox relay for {nip65Info.readers.length}{" "} + author + {nip65Info.readers.length !== 1 ? "s" : ""}
-
+ )} + {nip65Info && nip65Info.writers.length > 0 && ( + + +
+ + + {nip65Info.writers.length} + +
+
+ + Outbox relay for {nip65Info.writers.length}{" "} + author + {nip65Info.writers.length !== 1 ? "s" : ""} + +
+ )} + + {/* Fallback indicator */} + {nip65Info && nip65Info.isFallback && ( + + fallback + + )} + + {/* Auth icon */} + {authIcon && ( + + +
+ {authIcon.icon} +
+
+ +

{authIcon.label}

+
+
+ )} + + {/* Connection icon */} + + +
{connIcon.icon}
+
+ +

{connIcon.label}

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