import { useQuery, useQueryClient } from '@tanstack/react-query'; import { RelayForm } from '@app/relays/components/relayForm'; import { useNDK } from '@libs/ndk/provider'; import { useStorage } from '@libs/storage/provider'; import { CancelIcon } from '@shared/icons'; export function UserRelay() { const queryClient = useQueryClient(); const { relayUrls } = useNDK(); const { db } = useStorage(); const { status, data } = useQuery( ['user-relay'], async () => { return await db.getExplicitRelayUrls(); }, { refetchOnWindowFocus: false } ); const removeRelay = async (relayUrl: string) => { await db.removeRelay(relayUrl); queryClient.invalidateQueries(['user-relay']); }; return (
{status === 'loading' ? (

Loading...

) : (
{data.map((item) => (
{relayUrls.includes(item) ? ( ) : ( )}

{item}

))}
)}
); }