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

UserMediaPermissionsOverlay.js 2.7KB

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