Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

functions.web.ts 967B

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