import { TMailboxRelay } from '@/types' import { useMemo } from 'react' import { useTranslation } from 'react-i18next' import InfoCard from '../InfoCard' export default function RelayCountWarning({ relays }: { relays: TMailboxRelay[] }) { const { t } = useTranslation() const readRelayCount = useMemo(() => { return relays.filter((r) => r.scope !== 'write').length }, [relays]) const writeRelayCount = useMemo(() => { return relays.filter((r) => r.scope !== 'read').length }, [relays]) const showReadWarning = readRelayCount > 4 const showWriteWarning = writeRelayCount > 4 if (!showReadWarning && !showWriteWarning) { return null } return ( ) }