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.

AbstractRecentList.js 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. // @flow
  2. import React from 'react';
  3. import {
  4. createRecentClickedEvent,
  5. createRecentSelectedEvent,
  6. sendAnalytics
  7. } from '../../analytics';
  8. import { appNavigate } from '../../app';
  9. import {
  10. AbstractPage,
  11. Container,
  12. Text
  13. } from '../../base/react';
  14. import styles from './styles';
  15. /**
  16. * The type of the React {@code Component} props of {@link AbstractRecentList}
  17. */
  18. type Props = {
  19. /**
  20. * The redux store's {@code dispatch} function.
  21. */
  22. dispatch: Dispatch<*>,
  23. /**
  24. * The translate function.
  25. */
  26. t: Function
  27. };
  28. /**
  29. * An abstract component for the recent list.
  30. *
  31. */
  32. export default class AbstractRecentList<P: Props> extends AbstractPage<P> {
  33. /**
  34. * Initializes a new {@code RecentList} instance.
  35. *
  36. * @inheritdoc
  37. */
  38. constructor(props: P) {
  39. super(props);
  40. this._onPress = this._onPress.bind(this);
  41. }
  42. /**
  43. * Implements React's {@link Component#componentDidMount()}. Invoked
  44. * immediately after this component is mounted.
  45. *
  46. * @inheritdoc
  47. * @returns {void}
  48. */
  49. componentDidMount() {
  50. sendAnalytics(createRecentSelectedEvent());
  51. }
  52. _getRenderListEmptyComponent: () => React$Node;
  53. /**
  54. * Returns a list empty component if a custom one has to be rendered instead
  55. * of the default one in the {@link NavigateSectionList}.
  56. *
  57. * @private
  58. * @returns {React$Component}
  59. */
  60. _getRenderListEmptyComponent() {
  61. const { t } = this.props;
  62. return (
  63. <Container
  64. className = 'meetings-list-empty'
  65. style = { styles.emptyListContainer }>
  66. <Text
  67. className = 'description'
  68. style = { styles.emptyListText }>
  69. { t('welcomepage.recentListEmpty') }
  70. </Text>
  71. </Container>
  72. );
  73. }
  74. _onPress: string => {};
  75. /**
  76. * Handles the list's navigate action.
  77. *
  78. * @private
  79. * @param {string} url - The url string to navigate to.
  80. * @returns {void}
  81. */
  82. _onPress(url) {
  83. const { dispatch } = this.props;
  84. sendAnalytics(createRecentClickedEvent('recent.meeting.tile'));
  85. dispatch(appNavigate(url));
  86. }
  87. }