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.

AbstractUserMediaPermissionsOverlay.js 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import PropTypes from 'prop-types';
  2. import { Component } from 'react';
  3. /**
  4. * Implements a React {@link Component} for overlay with guidance how to proceed
  5. * with gUM prompt.
  6. */
  7. export default class AbstractUserMediaPermissionsOverlay extends Component {
  8. /**
  9. * {@code AbstractUserMediaPermissionsOverlay} component's property types.
  10. *
  11. * @static
  12. */
  13. static propTypes = {
  14. /**
  15. * The browser which is used currently. The text is different for every
  16. * browser.
  17. *
  18. * @public
  19. * @type {string}
  20. */
  21. browser: PropTypes.string,
  22. /**
  23. * The function to translate human-readable text.
  24. *
  25. * @public
  26. * @type {Function}
  27. */
  28. t: PropTypes.func
  29. };
  30. /**
  31. * Determines whether this overlay needs to be rendered (according to a
  32. * specific redux state). Called by {@link OverlayContainer}.
  33. *
  34. * @param {Object} state - The redux state.
  35. * @returns {boolean} - If this overlay needs to be rendered, {@code true};
  36. * {@code false}, otherwise.
  37. */
  38. static needsRender(state) {
  39. return state['features/overlay'].isMediaPermissionPromptVisible;
  40. }
  41. }
  42. /**
  43. * Maps (parts of) the redux state to the associated component's props.
  44. *
  45. * @param {Object} state - The redux state.
  46. * @protected
  47. * @returns {{
  48. * browser: string
  49. * }}
  50. */
  51. export function abstractMapStateToProps(state) {
  52. const { browser } = state['features/overlay'];
  53. return {
  54. browser
  55. };
  56. }