feat: sync relay sets

This commit is contained in:
codytseng
2025-01-07 23:26:05 +08:00
parent 4343765aba
commit 7bd5b915eb
38 changed files with 1069 additions and 686 deletions

View File

@@ -13,9 +13,9 @@ import SecondaryPageLayout from '@/layouts/SecondaryPageLayout'
import { toFollowingList } from '@/lib/link'
import { generateImageByPubkey } from '@/lib/pubkey'
import { SecondaryPageLink } from '@/PageManager'
import { useFeed } from '@/providers/FeedProvider'
import { useFollowList } from '@/providers/FollowListProvider'
import { useNostr } from '@/providers/NostrProvider'
import { useRelaySettings } from '@/providers/RelaySettingsProvider'
import { useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import NotFoundPage from '../NotFoundPage'
@@ -24,9 +24,12 @@ export default function ProfilePage({ id, index }: { id?: string; index?: number
const { t } = useTranslation()
const { profile, isFetching } = useFetchProfile(id)
const { relayList, isFetching: isFetchingRelayInfo } = useFetchRelayList(profile?.pubkey)
const { relayUrls: currentRelayUrls } = useRelaySettings()
const { relayUrls: currentRelayUrls } = useFeed()
const relayUrls = useMemo(
() => relayList.write.slice(0, 4).concat(currentRelayUrls.slice(0, 1)),
() =>
relayList.write.length < 4
? relayList.write.concat(currentRelayUrls).slice(0, 4)
: relayList.write.slice(0, 4),
[relayList, currentRelayUrls]
)
const { pubkey: accountPubkey } = useNostr()