From cbda6307a0e5d47febf288cd6714be3c9062966a Mon Sep 17 00:00:00 2001 From: Silberengel Date: Sat, 4 Oct 2025 20:22:57 +0200 Subject: [PATCH] make relays in relay sets clickable --- .../FavoriteRelaysSetting/RelayUrl.tsx | 9 +++++- src/components/RelaySetCard/index.tsx | 10 ++++++- src/constants.ts | 30 +++++++++++-------- src/hooks/useSearchProfiles.tsx | 8 ++--- 4 files changed, 36 insertions(+), 21 deletions(-) diff --git a/src/components/FavoriteRelaysSetting/RelayUrl.tsx b/src/components/FavoriteRelaysSetting/RelayUrl.tsx index b3f21ec..527ce24 100644 --- a/src/components/FavoriteRelaysSetting/RelayUrl.tsx +++ b/src/components/FavoriteRelaysSetting/RelayUrl.tsx @@ -1,6 +1,8 @@ import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' +import { toRelay } from '@/lib/link' import { isWebsocketUrl, normalizeUrl } from '@/lib/url' +import { useSecondaryPage } from '@/PageManager' import { useFavoriteRelays } from '@/providers/FavoriteRelaysProvider' import { CircleX } from 'lucide-react' import { useMemo, useState } from 'react' @@ -79,9 +81,14 @@ export default function RelayUrls({ relaySetId }: { relaySetId: string }) { } function RelayUrl({ url, onRemove }: { url: string; onRemove: () => void }) { + const { push } = useSecondaryPage() + return (
-
+
push(toRelay(url))} + >
{url}
diff --git a/src/components/RelaySetCard/index.tsx b/src/components/RelaySetCard/index.tsx index ae01c75..96d0dde 100644 --- a/src/components/RelaySetCard/index.tsx +++ b/src/components/RelaySetCard/index.tsx @@ -1,4 +1,6 @@ import { TRelaySet } from '@/types' +import { toRelay } from '@/lib/link' +import { useSecondaryPage } from '@/PageManager' import { ChevronDown, FolderClosed } from 'lucide-react' import { useState } from 'react' import { useTranslation } from 'react-i18next' @@ -66,12 +68,18 @@ function RelayUrlsExpandToggle({ } function RelayUrls({ urls }: { urls: string[] }) { + const { push } = useSecondaryPage() + if (!urls) return null return (
{urls.map((url) => ( -
+
push(toRelay(url))} + >
{url}
diff --git a/src/constants.ts b/src/constants.ts index 8c9c210..a4a14e7 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -60,11 +60,11 @@ export const ApplicationDataKey = { export const BIG_RELAY_URLS = [ 'wss://theforest.nostr1.com', 'wss://orly-relay.imwald.eu', - 'wss://thecitadel.nostr1.com/', - 'wss://nostr.wine', - 'wss://nostr.land/', + 'wss://nostr.land', + 'wss://nostr.wine/', 'wss://nostr.sovbit.host/', - 'wss://nostr21.com' + 'wss://nostr21.com', + 'wss://thecitadel.nostr1.com/' ] // Optimized relay list for read operations (includes aggregator) @@ -77,23 +77,27 @@ export const FAST_READ_RELAY_URLS = [ // Optimized relay list for write operations (no aggregator since it's read-only) export const FAST_WRITE_RELAY_URLS = [ - 'wss://nostr.wine', - 'wss://nostr.land', + 'wss://damus.io/', + 'wss://primal.net/', 'wss://freelay.sovbit.host/', 'wss://thecitadel.nostr1.com/' ] export const SEARCHABLE_RELAY_URLS = [ 'wss://relay.nostr.band/', - 'wss://freelay.sovbit.host/', - 'wss://relay.damus.io/', - 'wss://search.nos.today/', - 'wss://aggr.nostr.land', - 'wss://purplepag.es', - 'wss://profiles.nostr1.com'] + 'wss://search.nos.today/', + 'wss://nostr.wine', + 'wss://orly-relay.imwald.eu', + 'wss://aggr.nostr.land' + ] + +export const PROFILE_RELAY_URLS = [ + 'wss://purplepag.es', + 'wss://profiles.nostr1.com' + ] // Combined relay URLs for profile fetching - includes both BIG_RELAY_URLS and SEARCHABLE_RELAY_URLS -export const PROFILE_FETCH_RELAY_URLS = [...BIG_RELAY_URLS, ...SEARCHABLE_RELAY_URLS] +export const PROFILE_FETCH_RELAY_URLS = [...SEARCHABLE_RELAY_URLS, ...PROFILE_RELAY_URLS] export const GROUP_METADATA_EVENT_KIND = 39000 diff --git a/src/hooks/useSearchProfiles.tsx b/src/hooks/useSearchProfiles.tsx index 512e4c6..e764409 100644 --- a/src/hooks/useSearchProfiles.tsx +++ b/src/hooks/useSearchProfiles.tsx @@ -1,13 +1,9 @@ import { SEARCHABLE_RELAY_URLS } from '@/constants' -import { useFeed } from '@/providers/FeedProvider' import client from '@/services/client.service' import { TProfile } from '@/types' import { useEffect, useState } from 'react' -import { useFetchRelayInfos } from './useFetchRelayInfos' export function useSearchProfiles(search: string, limit: number) { - const { relayUrls } = useFeed() - const { searchableRelayUrls } = useFetchRelayInfos(relayUrls) const [isFetching, setIsFetching] = useState(true) const [error, setError] = useState(null) const [profiles, setProfiles] = useState([]) @@ -29,7 +25,7 @@ export function useSearchProfiles(search: string, limit: number) { } const existingPubkeys = new Set(profiles.map((profile) => profile.pubkey)) const fetchedProfiles = await client.searchProfiles( - searchableRelayUrls.concat(SEARCHABLE_RELAY_URLS).slice(0, 4), + SEARCHABLE_RELAY_URLS, { search, limit @@ -53,7 +49,7 @@ export function useSearchProfiles(search: string, limit: number) { } fetchProfiles() - }, [searchableRelayUrls, search, limit]) + }, [search, limit]) return { isFetching, error, profiles } }