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

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