Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

AbstractUserMediaPermissionsOverlay.js 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import PropTypes from 'prop-types';
  2. import { Component } from 'react';
  3. /**
  4. * Implements a React Component for overlay with guidance how to proceed with
  5. * gUM prompt.
  6. */
  7. export default class AbstractUserMediaPermissionsOverlay extends Component {
  8. /**
  9. * UserMediaPermissionsOverlay 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. * Check if this overlay needs to be rendered. This function will be called
  32. * by the {@code OverlayContainer}.
  33. *
  34. * @param {Object} state - The redux state.
  35. * @returns {boolean} - True if this overlay needs to be rendered, false
  36. * otherwise.
  37. */
  38. static needsRender(state) {
  39. return state['features/overlay'].isMediaPermissionPromptVisible;
  40. }
  41. /**
  42. * Implements React's {@link Component#render()}.
  43. *
  44. * @inheritdoc
  45. * @returns {ReactElement|null}
  46. */
  47. render() {
  48. return null;
  49. }
  50. }
  51. /**
  52. * Maps (parts of) the redux state to the associated component's props.
  53. *
  54. * @param {Object} state - The redux state.
  55. * @returns {{
  56. * browser: string
  57. * }}
  58. * @protected
  59. */
  60. export function abstractMapStateToProps(state) {
  61. const { browser } = state['features/overlay'];
  62. return {
  63. browser
  64. };
  65. }