2017-11-17 19:52:48 +08:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import Button from '/imports/ui/components/button/component';
|
|
|
|
import { injectIntl, defineMessages } from 'react-intl';
|
2018-01-08 14:17:18 +08:00
|
|
|
import { styles } from './styles';
|
2017-11-17 19:52:48 +08:00
|
|
|
|
|
|
|
const intlMessages = defineMessages({
|
|
|
|
descriptionHelp: {
|
|
|
|
id: 'app.audioModal.helpText',
|
|
|
|
description: 'Text decription for the audio help',
|
|
|
|
},
|
|
|
|
backLabel: {
|
|
|
|
id: 'app.audio.backLabel',
|
|
|
|
description: 'audio settings back button label',
|
2019-09-27 21:52:29 +08:00
|
|
|
},
|
|
|
|
noSSL: {
|
|
|
|
id: 'app.audioModal.help.noSSL',
|
|
|
|
description: 'Text decription for domain not using https',
|
|
|
|
},
|
|
|
|
macNotAllowed: {
|
|
|
|
id: 'app.audioModal.help.macNotAllowed',
|
|
|
|
description: 'Text decription for mac needed to enable OS setting',
|
|
|
|
},
|
|
|
|
});
|
2017-11-17 19:52:48 +08:00
|
|
|
|
|
|
|
class Help extends Component {
|
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
intl,
|
|
|
|
handleBack,
|
2019-09-30 22:54:34 +08:00
|
|
|
audioErr,
|
2017-11-17 19:52:48 +08:00
|
|
|
} = this.props;
|
|
|
|
|
2019-09-30 22:54:34 +08:00
|
|
|
const { code, MIC_ERROR } = audioErr;
|
|
|
|
|
2019-09-27 21:52:29 +08:00
|
|
|
let helpMessage = null;
|
|
|
|
|
2019-09-30 22:54:34 +08:00
|
|
|
switch (code) {
|
|
|
|
case MIC_ERROR.NO_SSL:
|
2019-09-27 21:52:29 +08:00
|
|
|
helpMessage = intl.formatMessage(intlMessages.noSSL);
|
|
|
|
break;
|
2019-09-30 22:54:34 +08:00
|
|
|
case MIC_ERROR.MAC_OS_BLOCK:
|
2019-09-27 21:52:29 +08:00
|
|
|
helpMessage = intl.formatMessage(intlMessages.macNotAllowed);
|
|
|
|
break;
|
2019-09-30 22:54:34 +08:00
|
|
|
case MIC_ERROR.NO_PERMISSION:
|
2019-09-27 21:52:29 +08:00
|
|
|
default:
|
|
|
|
helpMessage = intl.formatMessage(intlMessages.descriptionHelp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2017-11-17 19:52:48 +08:00
|
|
|
return (
|
|
|
|
<span className={styles.help}>
|
|
|
|
<div className={styles.text}>
|
2019-09-27 21:52:29 +08:00
|
|
|
{ helpMessage }
|
2017-11-17 19:52:48 +08:00
|
|
|
</div>
|
|
|
|
<div className={styles.enterAudio}>
|
|
|
|
<Button
|
|
|
|
className={styles.backBtn}
|
|
|
|
label={intl.formatMessage(intlMessages.backLabel)}
|
2019-09-27 21:52:29 +08:00
|
|
|
size="md"
|
|
|
|
color="primary"
|
2017-11-17 19:52:48 +08:00
|
|
|
onClick={handleBack}
|
|
|
|
ghost
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</span>
|
2019-09-27 21:52:29 +08:00
|
|
|
);
|
2017-11-17 19:52:48 +08:00
|
|
|
}
|
2019-09-27 21:52:29 +08:00
|
|
|
}
|
2017-11-17 19:52:48 +08:00
|
|
|
|
|
|
|
export default injectIntl(Help);
|