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 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /* global interfaceConfig */
  2. import React from 'react';
  3. import { translate, translateToHTML } from '../../base/i18n';
  4. import AbstractOverlay from './AbstractOverlay';
  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 { browser, 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. {
  60. t(
  61. 'startupoverlay.title',
  62. { postProcess: 'resolveAppName' })
  63. }
  64. </h3>
  65. <span className = 'inlay__text'>
  66. {
  67. translateToHTML(
  68. t,
  69. `userMedia.${browser}GrantPermissions`)
  70. }
  71. </span>
  72. </div>
  73. <div className = 'policy overlay__policy'>
  74. <p className = 'policy__text'>
  75. { t('startupoverlay.policyText') }
  76. </p>
  77. {
  78. this._renderPolicyLogo()
  79. }
  80. </div>
  81. </div>
  82. );
  83. }
  84. /**
  85. * Renders the policy logo.
  86. *
  87. * @returns {ReactElement|null}
  88. * @private
  89. */
  90. _renderPolicyLogo() {
  91. const { policyLogoSrc } = this.state;
  92. if (policyLogoSrc) {
  93. return (
  94. <div className = 'policy__logo'>
  95. <img src = { policyLogoSrc } />
  96. </div>
  97. );
  98. }
  99. return null;
  100. }
  101. }
  102. export default translate(UserMediaPermissionsOverlay);