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.tsx 2.6KB

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