import React from 'react'; import Tooltip from 'react-tooltip-lite'; import { Avatar } from './Avatar'; import { ContactName } from './conversation/ContactName'; import { LocalizerType } from '../types/Util'; import { AcceptCallType, CallDetailsType, DeclineCallType, } from '../state/ducks/calling'; export type PropsType = { acceptCall: (_: AcceptCallType) => void; callDetails?: CallDetailsType; declineCall: (_: DeclineCallType) => void; i18n: LocalizerType; }; type CallButtonProps = { classSuffix: string; tabIndex: number; tooltipContent: string; onClick: () => void; }; const CallButton = ({ classSuffix, onClick, tabIndex, tooltipContent, }: CallButtonProps): JSX.Element => { return ( ); }; export const IncomingCallBar = ({ acceptCall, callDetails, declineCall, i18n, }: PropsType): JSX.Element | null => { if (!callDetails) { return null; } const { avatarPath, callId, color, title, name, phoneNumber, profileName, } = callDetails; return (
{i18n( callDetails.isVideoCall ? 'incomingVideoCall' : 'incomingAudioCall' )}
{callDetails.isVideoCall ? ( <> { declineCall({ callId }); }} tabIndex={0} tooltipContent={i18n('declineCall')} /> { acceptCall({ callId, asVideoCall: false }); }} tabIndex={0} tooltipContent={i18n('acceptCallWithoutVideo')} /> { acceptCall({ callId, asVideoCall: true }); }} tabIndex={0} tooltipContent={i18n('acceptCall')} /> ) : ( <> { declineCall({ callId }); }} tabIndex={0} tooltipContent={i18n('declineCall')} /> { acceptCall({ callId, asVideoCall: false }); }} tabIndex={0} tooltipContent={i18n('acceptCall')} /> )}
); };