您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

AbstractRecentList.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // @flow
  2. import { Component } from 'react';
  3. import { appNavigate } from '../../app';
  4. /**
  5. * The type of the React {@code Component} props of {@link AbstractRecentList}
  6. */
  7. type Props = {
  8. /**
  9. * The redux store's {@code dispatch} function.
  10. */
  11. dispatch: Dispatch<*>
  12. };
  13. /**
  14. * Implements a React {@link Component} which represents the list of conferences
  15. * recently joined, similar to how a list of last dialed numbers list would do
  16. * on a mobile device.
  17. *
  18. * @extends Component
  19. */
  20. export default class AbstractRecentList extends Component<Props> {
  21. /**
  22. * Joins the selected room.
  23. *
  24. * @param {string} room - The selected room.
  25. * @returns {void}
  26. */
  27. _onJoin(room) {
  28. room && this.props.dispatch(appNavigate(room));
  29. }
  30. /**
  31. * Creates a bound onPress action for the list item.
  32. *
  33. * @param {string} room - The selected room.
  34. * @returns {Function}
  35. */
  36. _onSelect(room) {
  37. return this._onJoin.bind(this, room);
  38. }
  39. }
  40. /**
  41. * Maps redux state to component props.
  42. *
  43. * @param {Object} state - The redux state.
  44. * @returns {{
  45. * _homeServer: string,
  46. * _recentList: Array
  47. * }}
  48. */
  49. export function _mapStateToProps(state: Object) {
  50. return {
  51. _homeServer: state['features/app'].app._getDefaultURL(),
  52. _recentList: state['features/recent-list'].list
  53. };
  54. }