diff --git a/src/components/nostr/RichText/Relay.tsx b/src/components/nostr/RichText/Relay.tsx
index 76ae6d3..6e2d31c 100644
--- a/src/components/nostr/RichText/Relay.tsx
+++ b/src/components/nostr/RichText/Relay.tsx
@@ -1,22 +1,39 @@
import type { RelayNode } from "@/lib/relay-transformer";
-import { RelayLink } from "@/components/nostr/RelayLink";
+import { useGrimoire } from "@/core/state";
interface RelayNodeProps {
node: RelayNode;
}
+/**
+ * Format relay URL for display by removing protocol and trailing slashes
+ */
+function formatRelayUrlForDisplay(url: string): string {
+ return url
+ .replace(/^wss?:\/\//, "") // Remove ws:// or wss://
+ .replace(/\/$/, ""); // Remove trailing slash
+}
+
/**
* Renders a relay URL as a clickable link that opens the relay viewer
*/
export function Relay({ node }: RelayNodeProps) {
+ const { addWindow } = useGrimoire();
const { url } = node;
+ const displayUrl = formatRelayUrlForDisplay(url);
+
+ const openRelay = () => {
+ addWindow("relay", { url });
+ };
+
return (
-
+
);
}