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.

functions.ts 958B

12345678910111213141516171819202122232425262728293031323334
  1. import { IReduxState } from '../app/types';
  2. import { getOverlays } from './overlays';
  3. /**
  4. * Returns the overlay to be currently rendered.
  5. *
  6. * @param {IReduxState} state - The Redux state.
  7. * @returns {?React$ComponentType<*>}
  8. */
  9. export function getOverlayToRender(state: IReduxState) {
  10. for (const overlay of getOverlays()) {
  11. // react-i18n / react-redux wrap components and thus we cannot access
  12. // the wrapped component's static methods directly.
  13. // @ts-ignore
  14. const component = overlay.WrappedComponent || overlay;
  15. if (component.needsRender(state)) {
  16. return overlay;
  17. }
  18. }
  19. return undefined;
  20. }
  21. /**
  22. * Returns the visibility of the media permissions prompt.
  23. *
  24. * @param {IReduxState} state - The Redux state.
  25. * @returns {boolean}
  26. */
  27. export function getMediaPermissionPromptVisibility(state: IReduxState) {
  28. return state['features/overlay'].isMediaPermissionPromptVisible;
  29. }