bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/audio/echo-test/component.jsx

80 lines
2.1 KiB
React
Raw Normal View History

2017-10-04 04:42:10 +08:00
import React, { Component } from 'react';
2017-10-12 05:04:10 +08:00
import PropTypes from 'prop-types';
2017-10-04 04:42:10 +08:00
import Button from '/imports/ui/components/button/component';
2017-10-12 05:04:10 +08:00
import { defineMessages, intlShape, injectIntl } from 'react-intl';
2018-01-08 14:17:18 +08:00
import { styles } from './styles';
2017-10-04 04:42:10 +08:00
const intlMessages = defineMessages({
2018-04-04 00:48:02 +08:00
confirmLabel: {
2017-10-04 04:42:10 +08:00
id: 'app.audioModal.yes',
description: 'Hear yourself yes',
},
2018-04-04 00:48:02 +08:00
disconfirmLabel: {
2017-10-04 04:42:10 +08:00
id: 'app.audioModal.no',
description: 'Hear yourself no',
},
2018-04-04 00:48:02 +08:00
confirmAriaLabel: {
id: 'app.audioModal.yes.arialabel',
description: 'provides better context for yes btn label',
},
2018-04-04 00:48:02 +08:00
disconfirmAriaLabel: {
id: 'app.audioModal.no.arialabel',
description: 'provides better context for no btn label',
},
2017-10-04 04:42:10 +08:00
});
2017-10-12 05:04:10 +08:00
const propTypes = {
handleYes: PropTypes.func.isRequired,
handleNo: PropTypes.func.isRequired,
intl: intlShape.isRequired,
};
2017-10-04 04:42:10 +08:00
class EchoTest extends Component {
constructor(props) {
super(props);
2018-05-15 04:32:28 +08:00
this.state = {
disabled: false,
};
2017-10-05 04:49:11 +08:00
this.handleYes = props.handleYes.bind(this);
this.handleNo = props.handleNo.bind(this);
2017-10-04 04:42:10 +08:00
}
render() {
const {
intl,
} = this.props;
2018-05-15 04:32:28 +08:00
const disableYesButtonClicked = callback => () => {
this.setState({ disabled: true }, callback);
};
2017-10-04 04:42:10 +08:00
return (
2017-11-17 19:52:48 +08:00
<span className={styles.echoTest}>
2017-10-04 04:42:10 +08:00
<Button
2017-10-05 04:49:11 +08:00
className={styles.button}
2018-04-04 00:48:02 +08:00
label={intl.formatMessage(intlMessages.confirmLabel)}
aria-label={intl.formatMessage(intlMessages.confirmAriaLabel)}
icon="thumbs_up"
2018-05-15 04:32:28 +08:00
disabled={this.state.disabled}
2017-10-04 04:42:10 +08:00
circle
color="success"
size="jumbo"
2018-05-15 04:32:28 +08:00
onClick={disableYesButtonClicked(this.handleYes)}
2017-10-04 04:42:10 +08:00
/>
<Button
2017-10-05 04:49:11 +08:00
className={styles.button}
2018-04-04 00:48:02 +08:00
label={intl.formatMessage(intlMessages.disconfirmLabel)}
aria-label={intl.formatMessage(intlMessages.disconfirmAriaLabel)}
icon="thumbs_down"
2017-10-04 04:42:10 +08:00
circle
color="danger"
size="jumbo"
2017-10-12 05:04:10 +08:00
onClick={this.handleNo}
2017-10-04 04:42:10 +08:00
/>
2017-10-05 04:49:11 +08:00
</span>
2017-10-04 04:42:10 +08:00
);
}
}
export default injectIntl(EchoTest);
2017-10-12 05:04:10 +08:00
EchoTest.propTypes = propTypes;