import { Copy, CopyCheck } from "lucide-react";
import { useRelayInfo } from "../hooks/useRelayInfo";
import { useCopy } from "../hooks/useCopy";
import { Button } from "./ui/button";
import { UserName } from "./nostr/UserName";
import { NIPBadge } from "./NIPBadge";
export interface RelayViewerProps {
url: string;
}
export function RelayViewer({ url }: RelayViewerProps) {
const info = useRelayInfo(url);
const { copy, copied } = useCopy();
return (
{/* Header */}
{info?.name || "Unknown Relay"}
{url}
{info?.description && (
{info.description}
)}
{/* Operator */}
{(info?.contact || info?.pubkey) && (
Operator
{info.contact && info.contact.length == 64 && (
)}
{info.pubkey && info.pubkey.length === 64 && (
)}
)}
{/* Software */}
{(info?.software || info?.version) && (
Software
{info.software || info.version}
)}
{/* Supported NIPs */}
{info?.supported_nips && info.supported_nips.length > 0 && (
Supported NIPs
{info.supported_nips.map((num: number) => (
))}
)}
);
}