2019-08-03 05:32:42 +08:00
|
|
|
import React, { PureComponent } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2020-05-26 04:00:13 +08:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
2021-11-10 00:02:53 +08:00
|
|
|
import Styled from './styles';
|
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,
|
2021-08-09 22:24:02 +08:00
|
|
|
intl: PropTypes.shape({
|
|
|
|
formatMessage: PropTypes.func.isRequired,
|
|
|
|
}).isRequired,
|
2019-08-03 05:32:42 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class AudioAutoplayPrompt extends PureComponent {
|
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
intl,
|
|
|
|
handleAllowAutoplay,
|
|
|
|
} = this.props;
|
|
|
|
return (
|
2021-11-10 00:02:53 +08:00
|
|
|
<Styled.AutoplayPrompt>
|
|
|
|
<Styled.AutoplayButton
|
2019-08-03 05:32:42 +08:00
|
|
|
label={intl.formatMessage(intlMessages.confirmLabel)}
|
|
|
|
aria-label={intl.formatMessage(intlMessages.confirmAriaLabel)}
|
|
|
|
icon="thumbs_up"
|
|
|
|
circle
|
|
|
|
color="success"
|
|
|
|
size="jumbo"
|
|
|
|
onClick={handleAllowAutoplay}
|
|
|
|
/>
|
2021-11-10 00:02:53 +08:00
|
|
|
</Styled.AutoplayPrompt>
|
2019-08-03 05:32:42 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default injectIntl(AudioAutoplayPrompt);
|
|
|
|
|
|
|
|
AudioAutoplayPrompt.propTypes = propTypes;
|