您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

UserMediaPermissionsOverlay.js 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /* global interfaceConfig */
  2. import React from 'react';
  3. import { connect } from 'react-redux';
  4. import { translate, translateToHTML } from '../../base/i18n';
  5. import AbstractUserMediaPermissionsOverlay, { abstractMapStateToProps }
  6. from './AbstractUserMediaPermissionsOverlay';
  7. import OverlayFrame from './OverlayFrame';
  8. /**
  9. * Implements a React Component for overlay with guidance how to proceed with
  10. * gUM prompt.
  11. */
  12. class UserMediaPermissionsOverlay extends AbstractUserMediaPermissionsOverlay {
  13. /**
  14. * Initializes a new UserMediaPermissionsOverlay instance.
  15. *
  16. * @param {Object} props - The read-only properties with which the new
  17. * instance is to be initialized.
  18. * @public
  19. */
  20. constructor(props) {
  21. super(props);
  22. this.state = {
  23. /**
  24. * The src value of the image for the policy logo.
  25. *
  26. * @type {string}
  27. */
  28. policyLogoSrc: interfaceConfig.POLICY_LOGO
  29. };
  30. }
  31. /**
  32. * Implements React's {@link Component#render()}.
  33. *
  34. * @inheritdoc
  35. * @override
  36. * @returns {ReactElement|null}
  37. */
  38. render() {
  39. const { browser, t } = this.props;
  40. return (
  41. <OverlayFrame>
  42. <div className = 'inlay'>
  43. <span className = 'inlay__icon icon-microphone' />
  44. <span className = 'inlay__icon icon-camera' />
  45. <h3 className = 'inlay__title'>
  46. {
  47. t('startupoverlay.title',
  48. { postProcess: 'resolveAppName' })
  49. }
  50. </h3>
  51. <span className = 'inlay__text'>
  52. {
  53. translateToHTML(t,
  54. `userMedia.${browser}GrantPermissions`)
  55. }
  56. </span>
  57. </div>
  58. <div className = 'policy overlay__policy'>
  59. <p className = 'policy__text'>
  60. { translateToHTML(t, 'startupoverlay.policyText') }
  61. </p>
  62. {
  63. this._renderPolicyLogo()
  64. }
  65. </div>
  66. </OverlayFrame>
  67. );
  68. }
  69. /**
  70. * Renders the policy logo.
  71. *
  72. * @returns {ReactElement|null}
  73. * @private
  74. */
  75. _renderPolicyLogo() {
  76. const { policyLogoSrc } = this.state;
  77. if (policyLogoSrc) {
  78. return (
  79. <div className = 'policy__logo'>
  80. <img src = { policyLogoSrc } />
  81. </div>
  82. );
  83. }
  84. return null;
  85. }
  86. }
  87. export default translate(
  88. connect(abstractMapStateToProps)(UserMediaPermissionsOverlay));