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

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