import type { ReactElement } from 'react'
import { Typography } from '@material-ui/core/'
type Props = StatusTopologyHook
export default function PeerConnection({ isLoading, isOk, topology }: Props): ReactElement | null {
if (isLoading) return null
const peers = (
Connected Peers
{topology?.connected ? topology.connected : '-'}
Discovered Nodes
{topology?.population ? topology.population : '-'}
)
if (isOk) {
return (
<>
You are connected to peers!
{peers}
>
)
}
return (
<>
Your node is not connected to any peers
{peers}
>
)
}