import { Skeleton } from '@/components/ui/skeleton' import { useFetchRelayInfo } from '@/hooks' import { toRelay } from '@/lib/link' import { useSecondaryPage } from '@/PageManager' import relayInfoService from '@/services/relay-info.service' import { TAwesomeRelayCollection } from '@/types' import { useEffect, useState } from 'react' import RelaySimpleInfo, { RelaySimpleInfoSkeleton } from '../RelaySimpleInfo' import { useDeepBrowsing } from '@/providers/DeepBrowsingProvider' import { cn } from '@/lib/utils' export default function Explore() { const [collections, setCollections] = useState(null) useEffect(() => { relayInfoService.getAwesomeRelayCollections().then(setCollections) }, []) if (!collections) { return (
) } return (
{collections.map((collection) => ( ))}
) } function RelayCollection({ collection }: { collection: TAwesomeRelayCollection }) { const { deepBrowsing } = useDeepBrowsing() return (
{collection.name}
{collection.relays.map((url) => ( ))}
) } function RelayItem({ url }: { url: string }) { const { push } = useSecondaryPage() const { relayInfo, isFetching } = useFetchRelayInfo(url) if (isFetching) { return } if (!relayInfo) { return null } return ( { e.stopPropagation() push(toRelay(relayInfo.url)) }} /> ) }