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.web.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* global interfaceConfig */
  2. import { NavigateSectionList } from '../base/react';
  3. import { toDisplayableItem } from './functions.any';
  4. /**
  5. * Transforms the history list to a displayable list
  6. * with sections.
  7. *
  8. * @private
  9. * @param {Array<Object>} recentList - The recent list form the redux store.
  10. * @param {Function} t - The translate function.
  11. * @param {string} defaultServerURL - The default server URL.
  12. * @returns {Array<Object>}
  13. */
  14. export function toDisplayableList(recentList, t, defaultServerURL) {
  15. const { createSection } = NavigateSectionList;
  16. const section
  17. = createSection(t('recentList.joinPastMeeting'), 'joinPastMeeting');
  18. // We only want the last three conferences we were in for web.
  19. for (const item of recentList.slice(-3)) {
  20. const displayableItem = toDisplayableItem(item, defaultServerURL, t);
  21. section.data.push(displayableItem);
  22. }
  23. const displayableList = [];
  24. if (section.data.length) {
  25. section.data.reverse();
  26. displayableList.push(section);
  27. }
  28. return displayableList;
  29. }
  30. /**
  31. * Returns <tt>true</tt> if recent list is enabled and <tt>false</tt> otherwise.
  32. *
  33. * @returns {boolean} <tt>true</tt> if recent list is enabled and <tt>false</tt>
  34. * otherwise.
  35. */
  36. export function isRecentListEnabled() {
  37. return interfaceConfig.RECENT_LIST_ENABLED;
  38. }