11import React from 'react' ;
22import PropTypes from 'prop-types' ;
33import classnames from 'classnames' ;
4+ import recordStatus from 'ringcentral-integration/modules/Webphone/recordStatus' ;
45import CircleButton from '../CircleButton' ;
56import ActiveCallButton from '../ActiveCallButton' ;
67import MuteIcon from '../../assets/images/Mute.svg' ;
@@ -37,10 +38,15 @@ export default function ActiveCallPad(props) {
3738 const onHoldClicked = props . isOnHold ?
3839 props . onUnhold :
3940 props . onHold ;
40- const onRecordClicked = props . isOnRecord ?
41+ const onRecordClicked = props . recordStatus === recordStatus . recording ?
4142 props . onStopRecord :
4243 props . onRecord ;
4344 const disabledFlip = props . flipNumbers . length === 0 ;
45+ const recordTitle = props . recordStatus === recordStatus . recording ?
46+ i18n . getString ( 'stopRecord' , props . currentLocale ) :
47+ i18n . getString ( 'record' , props . currentLocale ) ;
48+ const isRecordButtonActive = props . recordStatus === recordStatus . recording ;
49+ const isRecordDisabled = props . recordStatus === recordStatus . pending ;
4450 return (
4551 < div className = { classnames ( styles . root , props . className ) } >
4652 < div className = { styles . callCtrlButtonGroup } >
@@ -74,15 +80,11 @@ export default function ActiveCallPad(props) {
7480 />
7581 < ActiveCallButton
7682 onClick = { props . isOnHold ? ( ) => { } : onRecordClicked }
77- title = {
78- props . isOnRecord ?
79- i18n . getString ( 'stopRecord' , props . currentLocale ) :
80- i18n . getString ( 'record' , props . currentLocale )
81- }
82- active = { props . isOnRecord }
83+ title = { recordTitle }
84+ active = { isRecordButtonActive }
8385 className = { styles . callButton }
8486 icon = { RecordIcon }
85- disabled = { props . isOnHold }
87+ disabled = { props . isOnHold || isRecordDisabled }
8688 />
8789 < ActiveCallButton
8890 onClick = { props . onAdd }
@@ -126,7 +128,7 @@ ActiveCallPad.propTypes = {
126128 className : PropTypes . string ,
127129 isOnMute : PropTypes . bool ,
128130 isOnHold : PropTypes . bool ,
129- isOnRecord : PropTypes . bool ,
131+ recordStatus : PropTypes . string . isRequired ,
130132 onMute : PropTypes . func . isRequired ,
131133 onUnmute : PropTypes . func . isRequired ,
132134 onHold : PropTypes . func . isRequired ,
@@ -144,5 +146,4 @@ ActiveCallPad.defaultProps = {
144146 className : null ,
145147 isOnMute : false ,
146148 isOnHold : false ,
147- isOnRecord : false ,
148149} ;
0 commit comments