import { Box } from '@mui/system' import ListItemText from '@mui/material/ListItemText' import SyncAltIcon from '@mui/icons-material/SyncAlt' import NetworkPingIcon from '@mui/icons-material/NetworkPing' import ListItem from '@mui/material/ListItem' import { Tooltip } from '@mui/material' import { AudioVolume } from 'components/AudioVolume' import { PeerNameDisplay } from 'components/PeerNameDisplay' import { Peer } from 'models/chat' import { PeerConnectionType } from 'services/PeerRoom/PeerRoom' import { PeerDownloadFileButton } from './PeerDownloadFileButton' interface PeerListItemProps { peer: Peer peerConnectionTypes: Record peerAudios: Record } export const PeerListItem = ({ peer, peerConnectionTypes, peerAudios, }: PeerListItemProps): JSX.Element => { const hasPeerConnection = peer.peerId in peerConnectionTypes const isPeerConnectionDirect = peerConnectionTypes[peer.peerId] === PeerConnectionType.DIRECT return ( {hasPeerConnection ? ( You are connected directly to{' '} {peer.userId} ) : ( <> You are connected to{' '} {peer.userId} {' '} via a relay server. Your connection is still private and encrypted, but performance may be degraded. ) } > {isPeerConnectionDirect ? ( ) : ( )} ) : null} {peer.userId} {peer.peerId in peerAudios && ( )} ) }