2017-09-26 04:28:36 +08:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2017-09-20 01:47:57 +08:00
|
|
|
import Button from '/imports/ui/components/button/component';
|
2017-09-26 04:28:36 +08:00
|
|
|
import styles from './styles';
|
2017-09-20 01:47:57 +08:00
|
|
|
|
2017-09-26 04:28:36 +08:00
|
|
|
const propTypes = {
|
|
|
|
handleToggleMuteMicrophone: PropTypes.func.isRequired,
|
|
|
|
handleJoinAudio: PropTypes.func.isRequired,
|
|
|
|
handleLeaveAudio: PropTypes.func.isRequired,
|
2017-10-23 20:41:09 +08:00
|
|
|
disable: PropTypes.bool.isRequired,
|
2017-09-26 04:28:36 +08:00
|
|
|
unmute: PropTypes.bool.isRequired,
|
|
|
|
mute: PropTypes.bool.isRequired,
|
|
|
|
join: PropTypes.bool.isRequired,
|
|
|
|
};
|
2017-09-20 01:47:57 +08:00
|
|
|
|
2017-09-26 04:28:36 +08:00
|
|
|
const AudioControls = ({
|
2017-09-20 01:47:57 +08:00
|
|
|
handleToggleMuteMicrophone,
|
|
|
|
handleJoinAudio,
|
|
|
|
handleLeaveAudio,
|
|
|
|
mute,
|
|
|
|
unmute,
|
2017-10-20 18:11:51 +08:00
|
|
|
disable,
|
2017-09-20 01:47:57 +08:00
|
|
|
join,
|
2017-09-26 04:28:36 +08:00
|
|
|
}) => (
|
2017-09-20 01:47:57 +08:00
|
|
|
<span className={styles.container}>
|
|
|
|
{mute ?
|
|
|
|
<Button
|
2017-10-12 22:49:50 +08:00
|
|
|
className={styles.button}
|
2017-09-20 01:47:57 +08:00
|
|
|
onClick={handleToggleMuteMicrophone}
|
2017-10-23 20:41:09 +08:00
|
|
|
disabled={disable}
|
2017-09-20 01:47:57 +08:00
|
|
|
label={unmute ? 'Unmute' : 'Mute'}
|
|
|
|
color={'primary'}
|
|
|
|
icon={unmute ? 'mute' : 'unmute'}
|
|
|
|
size={'lg'}
|
|
|
|
circle
|
|
|
|
/> : null}
|
|
|
|
<Button
|
2017-10-12 22:49:50 +08:00
|
|
|
className={styles.button}
|
2017-09-26 04:28:36 +08:00
|
|
|
onClick={join ? handleLeaveAudio : handleJoinAudio}
|
2017-10-23 20:41:09 +08:00
|
|
|
disabled={disable}
|
2017-09-26 04:28:36 +08:00
|
|
|
label={join ? 'Leave Audio' : 'Join Audio'}
|
|
|
|
color={join ? 'danger' : 'primary'}
|
|
|
|
icon={join ? 'audio_off' : 'audio_on'}
|
2017-09-20 01:47:57 +08:00
|
|
|
size={'lg'}
|
|
|
|
circle
|
|
|
|
/>
|
|
|
|
</span>);
|
2017-09-26 04:28:36 +08:00
|
|
|
|
|
|
|
AudioControls.propTypes = propTypes;
|
|
|
|
|
|
|
|
export default AudioControls;
|