import { emptyArray, emptyFn, format } from '@ringcentral-integration/utils'; import type { FunctionComponent } from 'react'; import React, { useState } from 'react'; import { Button } from '../Button'; import CarrouselBar from '../CarrouselBar'; import { DurationCounter } from '../DurationCounter'; import { CallInfoBar } from './CallInfoBar'; import i18n from './i18n'; import styles from './styles.scss'; type CallMonitorBarProps = { currentLocale: string; ringingCalls?: any[]; currentCalls?: any[]; onHoldCalls?: any[]; otherDeviceCalls?: any[]; onCurrentCallBtnClick?: () => void; onViewCallBtnClick?: () => void; shouldDisplayCurrentCallBtn?: boolean; shouldDisplayViewCallsBtn?: boolean; shouldHideRingingCallStatus?: boolean; clickHeaderTrack?: () => void; useV2?: boolean; }; export const CallMonitorBar: FunctionComponent = ( props, ) => { const { ringingCalls = emptyArray, currentCalls = emptyArray, onHoldCalls = emptyArray, otherDeviceCalls = emptyArray, onCurrentCallBtnClick, onViewCallBtnClick, shouldDisplayCurrentCallBtn = false, shouldDisplayViewCallsBtn = false, shouldHideRingingCallStatus = false, clickHeaderTrack = emptyFn, useV2 = false, currentLocale, } = props; const [hoverBar, setHoverBar] = useState(false); const showBtn = () => { if (currentCalls.length > 0) { setHoverBar(true); } }; const hideBtn = () => { setHoverBar(false); }; const numberOfIncomingCalls = ringingCalls.length; const numberOfOnHoldCalls = onHoldCalls.length; const numberOfOtherDeviceCalls = otherDeviceCalls.length; return (
{numberOfOnHoldCalls > 0 ? ( ) : null} {!shouldHideRingingCallStatus && numberOfIncomingCalls > 0 ? ( ) : null} {numberOfOtherDeviceCalls > 0 ? ( ) : null} {currentCalls.length > 0 ? (
{shouldDisplayCurrentCallBtn && onCurrentCallBtnClick ? ( ) : null}
) : null}
); };