// Copyright 2024 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only /* eslint-disable react/no-array-index-key */ import React from 'react'; import classNames from 'classnames'; import { Avatar, AvatarSize } from './Avatar'; import { ContactName } from './conversation/ContactName'; import { InContactsIcon } from './InContactsIcon'; import type { CallLinkType } from '../types/CallLink'; import type { LocalizerType } from '../types/Util'; import type { ServiceIdString } from '../types/ServiceId'; import { sortByTitle } from '../util/sortByTitle'; import type { ConversationType } from '../state/ducks/conversations'; import { ModalHost } from './ModalHost'; import { isInSystemContacts } from '../util/isInSystemContacts'; type ParticipantType = ConversationType & { hasRemoteAudio?: boolean; hasRemoteVideo?: boolean; isHandRaised?: boolean; presenting?: boolean; }; export type PropsType = { readonly callLink: CallLinkType; readonly i18n: LocalizerType; readonly ourServiceId: ServiceIdString | undefined; readonly participants: Array; readonly onClose: () => void; readonly onCopyCallLink: () => void; }; export function CallingAdhocCallInfo({ i18n, ourServiceId, participants, onClose, onCopyCallLink, }: PropsType): JSX.Element | null { const sortedParticipants = React.useMemo>( () => sortByTitle(participants), [participants] ); return (
{participants.length ? i18n('icu:calling__in-this-call', { people: participants.length, }) : i18n('icu:calling__in-this-call--zero')}
    {sortedParticipants.map( (participant: ParticipantType, index: number) => (
  • {ourServiceId && participant.serviceId === ourServiceId ? ( {i18n('icu:you')} ) : ( <> {isInSystemContacts(participant) ? ( {' '} ) : null} )}
  • ) )}
); }