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

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