You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UserMediaPermissionsOverlay.js 2.8KB

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