diff --git a/src/components/RelayViewer.tsx b/src/components/RelayViewer.tsx index 6e50325..44f1ce6 100644 --- a/src/components/RelayViewer.tsx +++ b/src/components/RelayViewer.tsx @@ -3,7 +3,7 @@ import { useRelayInfo } from "../hooks/useRelayInfo"; import { useCopy } from "../hooks/useCopy"; import { Button } from "./ui/button"; import { UserName } from "./nostr/UserName"; -import { NIPBadge } from "./NIPBadge"; +import { RelaySupportedNips } from "./nostr/RelaySupportedNips"; export interface RelayViewerProps { url: string; @@ -68,19 +68,8 @@ export function RelayViewer({ url }: RelayViewerProps) { )} {/* Supported NIPs */} - {info?.supported_nips && info.supported_nips.length > 0 && ( -
-

Supported NIPs

-
- {info.supported_nips.map((num: number) => ( - - ))} -
-
+ {info?.supported_nips && ( + )} ); diff --git a/src/components/nostr/RelaySupportedNips.tsx b/src/components/nostr/RelaySupportedNips.tsx index c12aa7b..c0cfe8d 100644 --- a/src/components/nostr/RelaySupportedNips.tsx +++ b/src/components/nostr/RelaySupportedNips.tsx @@ -1,35 +1,35 @@ -import { Label } from "@/components/ui/label"; import { NIPBadge } from "@/components/NIPBadge"; -import { FileText } from "lucide-react"; interface RelaySupportedNipsProps { nips: number[]; + title?: string; + showTitle?: boolean; } /** * Relay Supported NIPs Display Component * Shows supported Nostr Implementation Possibilities (NIPs) for a relay - * Used in both Relay Discovery and Monitor Announcement detail views + * Used in RelayViewer and Relay Discovery detail views + * Renders NIP badges with names for better readability */ -export function RelaySupportedNips({ nips }: RelaySupportedNipsProps) { +export function RelaySupportedNips({ + nips, + title = "Supported NIPs", + showTitle = true, +}: RelaySupportedNipsProps) { if (nips.length === 0) { return null; } return ( -
- -
+
+ {showTitle &&

{title}

} +
{nips.map((nip) => ( ))}
diff --git a/src/components/nostr/kinds/RelayDiscoveryDetailRenderer.tsx b/src/components/nostr/kinds/RelayDiscoveryDetailRenderer.tsx index b215a29..6e1eadd 100644 --- a/src/components/nostr/kinds/RelayDiscoveryDetailRenderer.tsx +++ b/src/components/nostr/kinds/RelayDiscoveryDetailRenderer.tsx @@ -221,7 +221,12 @@ export function RelayDiscoveryDetailRenderer({ event }: { event: NostrEvent }) { )} {/* Supported NIPs */} - + {nips.length > 0 && ( + + )} {/* Relay Kinds */}