2019-08-03 05:32:42 +08:00
|
|
|
import React, { PureComponent } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import Button from '/imports/ui/components/button/component';
|
2020-05-26 04:00:13 +08:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
2019-08-03 05:32:42 +08:00
|
|
|
import { styles } from './styles';
|
|
|
|
|
2019-08-15 03:15:11 +08:00
|
|
|
|
2019-08-03 05:32:42 +08:00
|
|
|
const intlMessages = defineMessages({
|
|
|
|
confirmLabel: {
|
2019-08-15 03:15:11 +08:00
|
|
|
id: 'app.audioModal.playAudio',
|
|
|
|
description: 'Play audio prompt for autoplay',
|
2019-08-03 05:32:42 +08:00
|
|
|
},
|
|
|
|
confirmAriaLabel: {
|
2019-08-15 03:15:11 +08:00
|
|
|
id: 'app.audioModal.playAudio.arialabel',
|
|
|
|
description: 'Provides better context for play audio prompt btn label',
|
2019-08-03 05:32:42 +08:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const propTypes = {
|
|
|
|
handleAllowAutoplay: PropTypes.func.isRequired,
|
2020-05-26 04:00:13 +08:00
|
|
|
intl: PropTypes.object.isRequired,
|
2019-08-03 05:32:42 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class AudioAutoplayPrompt extends PureComponent {
|
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
intl,
|
|
|
|
handleAllowAutoplay,
|
|
|
|
} = this.props;
|
|
|
|
return (
|
|
|
|
<span className={styles.autoplayPrompt}>
|
|
|
|
<Button
|
|
|
|
className={styles.button}
|
|
|
|
label={intl.formatMessage(intlMessages.confirmLabel)}
|
|
|
|
aria-label={intl.formatMessage(intlMessages.confirmAriaLabel)}
|
|
|
|
icon="thumbs_up"
|
|
|
|
circle
|
|
|
|
color="success"
|
|
|
|
size="jumbo"
|
|
|
|
onClick={handleAllowAutoplay}
|
|
|
|
/>
|
|
|
|
</span>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default injectIntl(AudioAutoplayPrompt);
|
|
|
|
|
|
|
|
AudioAutoplayPrompt.propTypes = propTypes;
|