您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

functions.js 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { translateToHTML } from '../base/i18n';
  2. import { isSuboptimalBrowser } from '../base/environment';
  3. import { toState } from '../base/redux';
  4. import {
  5. areThereNotifications,
  6. showWarningNotification
  7. } from '../notifications';
  8. import { getOverlayToRender } from '../overlay';
  9. /**
  10. * Shows the suboptimal experience notification if needed.
  11. *
  12. * @param {Function} dispatch - The dispatch method.
  13. * @param {Function} t - The translation function.
  14. * @returns {void}
  15. */
  16. export function maybeShowSuboptimalExperienceNotification(dispatch, t) {
  17. if (isSuboptimalBrowser()) {
  18. dispatch(
  19. showWarningNotification(
  20. {
  21. titleKey: 'notify.suboptimalExperienceTitle',
  22. description: translateToHTML(
  23. t,
  24. 'notify.suboptimalBrowserWarning',
  25. {
  26. recommendedBrowserPageLink: `${window.location.origin}/static/recommendedBrowsers.html`
  27. }
  28. )
  29. }
  30. )
  31. );
  32. }
  33. }
  34. /**
  35. * Tells whether or not the notifications should be displayed within
  36. * the conference feature based on the current Redux state.
  37. *
  38. * @param {Object|Function} stateful - The redux store state.
  39. * @returns {boolean}
  40. */
  41. export function shouldDisplayNotifications(stateful) {
  42. const state = toState(stateful);
  43. const isAnyOverlayVisible = Boolean(getOverlayToRender(state));
  44. const { calleeInfoVisible } = state['features/invite'];
  45. return areThereNotifications(state)
  46. && !isAnyOverlayVisible
  47. && !calleeInfoVisible;
  48. }