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

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