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,
|
|
|
|
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,
|
|
|
|
join,
|
2017-09-26 04:28:36 +08:00
|
|
|
}) => (
|
2017-09-20 01:47:57 +08:00
|
|
|
<span className={styles.container}>
|
|
|
|
{mute ?
|
|
|
|
<Button
|
|
|
|
onClick={handleToggleMuteMicrophone}
|
|
|
|
label={unmute ? 'Unmute' : 'Mute'}
|
|
|
|
color={'primary'}
|
|
|
|
icon={unmute ? 'mute' : 'unmute'}
|
|
|
|
size={'lg'}
|
|
|
|
circle
|
|
|
|
/> : null}
|
|
|
|
<Button
|
2017-09-26 04:28:36 +08:00
|
|
|
onClick={join ? handleLeaveAudio : handleJoinAudio}
|
|
|
|
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;
|