Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

functions.web.ts 842B

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