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.0KB

12345678910111213141516171819202122232425262728293031323334
  1. import { NavigateSectionList } from '../base/react/index';
  2. import { toDisplayableItem } from './functions.all';
  3. /**
  4. * Transforms the history list to a displayable list
  5. * with sections.
  6. *
  7. * @private
  8. * @param {Array<Object>} recentList - The recent list form the redux store.
  9. * @param {Function} t - The translate function.
  10. * @param {string} defaultServerURL - The default server URL.
  11. * @returns {Array<Object>}
  12. */
  13. export function toDisplayableList(recentList, t, defaultServerURL) {
  14. const { createSection } = NavigateSectionList;
  15. const section = createSection(t('recentList.joinPastMeeting'), 'all');
  16. // we only want the last three conferences we were in for web
  17. for (const item of recentList.slice(1).slice(-3)) {
  18. const displayableItem = toDisplayableItem(item, defaultServerURL, t);
  19. section.data.push(displayableItem);
  20. }
  21. const displayableList = [];
  22. if (section.data.length) {
  23. section.data.reverse();
  24. displayableList.push(section);
  25. }
  26. return displayableList;
  27. }