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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. *
  19. * @public
  20. * @type {string}
  21. */
  22. browser: React.PropTypes.string
  23. }
  24. /**
  25. * Initializes a new SuspendedOverlay instance.
  26. *
  27. * @param {Object} props - The read-only properties with which the new
  28. * instance is to be initialized.
  29. * @public
  30. */
  31. constructor(props) {
  32. super(props);
  33. this.state = {
  34. /**
  35. * The src value of the image for the policy logo.
  36. *
  37. * @type {string}
  38. */
  39. policyLogoSrc: interfaceConfig.POLICY_LOGO
  40. };
  41. }
  42. /**
  43. * Constructs overlay body with the message with guidance how to proceed
  44. * with gUM prompt.
  45. *
  46. * @returns {ReactElement|null}
  47. * @override
  48. * @protected
  49. */
  50. _renderOverlayContent() {
  51. const textKey = `userMedia.${this.props.browser}GrantPermissions`;
  52. return (
  53. <div>
  54. <div className = 'inlay'>
  55. <span className = 'inlay__icon icon-microphone' />
  56. <span className = 'inlay__icon icon-camera' />
  57. <h3
  58. className = 'inlay__title'
  59. data-i18n = 'startupoverlay.title'
  60. data-i18n-options
  61. = '{"postProcess": "resolveAppName"}' />
  62. <span
  63. className = 'inlay__text'
  64. data-i18n = { `[html]${textKey}` } />
  65. </div>
  66. <div className = 'policy overlay__policy'>
  67. <p
  68. className = 'policy__text'
  69. data-i18n = '[html]startupoverlay.policyText' />
  70. {
  71. this._renderPolicyLogo()
  72. }
  73. </div>
  74. </div>
  75. );
  76. }
  77. /**
  78. * Renders the policy logo.
  79. *
  80. * @returns {ReactElement|null}
  81. * @private
  82. */
  83. _renderPolicyLogo() {
  84. const { policyLogoSrc } = this.state;
  85. if (policyLogoSrc) {
  86. return (
  87. <div className = 'policy__logo'>
  88. <img src = { policyLogoSrc } />
  89. </div>
  90. );
  91. }
  92. return null;
  93. }
  94. }