// Copyright 2020 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; import { Avatar } from './Avatar'; import { Tooltip } from './Tooltip'; import { Theme } from '../util/theme'; import { ContactName } from './conversation/ContactName'; import { LocalizerType } from '../types/Util'; import { ColorType } from '../types/Colors'; import { AcceptCallType, DeclineCallType } from '../state/ducks/calling'; export type PropsType = { acceptCall: (_: AcceptCallType) => void; declineCall: (_: DeclineCallType) => void; i18n: LocalizerType; call: { isVideoCall: boolean; }; conversation: { id: string; avatarPath?: string; color?: ColorType; title: string; name?: string; phoneNumber?: string; profileName?: string; }; }; type CallButtonProps = { classSuffix: string; tabIndex: number; tooltipContent: string; onClick: () => void; }; const CallButton = ({ classSuffix, onClick, tabIndex, tooltipContent, }: CallButtonProps): JSX.Element => { return ( ); }; export const IncomingCallBar = ({ acceptCall, declineCall, i18n, call, conversation, }: PropsType): JSX.Element | null => { const { isVideoCall } = call; const { id: conversationId, avatarPath, color, title, name, phoneNumber, profileName, } = conversation; return (
{i18n(isVideoCall ? 'incomingVideoCall' : 'incomingAudioCall')}
{isVideoCall ? ( <> { declineCall({ conversationId }); }} tabIndex={0} tooltipContent={i18n('declineCall')} /> { acceptCall({ conversationId, asVideoCall: false }); }} tabIndex={0} tooltipContent={i18n('acceptCallWithoutVideo')} /> { acceptCall({ conversationId, asVideoCall: true }); }} tabIndex={0} tooltipContent={i18n('acceptCall')} /> ) : ( <> { declineCall({ conversationId }); }} tabIndex={0} tooltipContent={i18n('declineCall')} /> { acceptCall({ conversationId, asVideoCall: false }); }} tabIndex={0} tooltipContent={i18n('acceptCall')} /> )}
); };