/* eslint-disable react/no-array-index-key */ import React from 'react'; import { createPortal } from 'react-dom'; import { Avatar } from './Avatar'; import { ColorType } from '../types/Colors'; import { ContactName } from './conversation/ContactName'; import { LocalizerType } from '../types/Util'; type ParticipantType = { audioMuted?: boolean; avatarPath?: string; color?: ColorType; profileName?: string; title: string; videoMuted?: boolean; }; export type PropsType = { readonly i18n: LocalizerType; readonly onClose: () => void; readonly participants: Array; }; export const CallingParticipantsList = React.memo( ({ i18n, onClose, participants }: PropsType) => { const [root, setRoot] = React.useState(null); React.useEffect(() => { const div = document.createElement('div'); document.body.appendChild(div); setRoot(div); return () => { document.body.removeChild(div); setRoot(null); }; }, []); if (!root) { return null; } return createPortal(
{participants.length > 1 ? i18n('calling__in-this-call--many', [ String(participants.length), ]) : i18n('calling__in-this-call--one')}
    {participants.map((participant: ParticipantType, index: number) => (
  • {participant.audioMuted ? ( ) : null} {participant.videoMuted ? ( ) : null}
  • ))}
, root ); } );