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

AbstractRecentList.js 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. _defaultURL: string,
  9. _recentList: Array<Object>,
  10. /**
  11. * Indicates if the list is disabled or not.
  12. */
  13. disabled: boolean,
  14. /**
  15. * The redux store's {@code dispatch} function.
  16. */
  17. dispatch: Dispatch<*>
  18. };
  19. /**
  20. * Implements a React {@link Component} which represents the list of conferences
  21. * recently joined, similar to how a list of last dialed numbers list would do
  22. * on a mobile device.
  23. *
  24. * @extends Component
  25. */
  26. export default class AbstractRecentList extends Component<Props> {
  27. /**
  28. * Joins the selected room.
  29. *
  30. * @param {string} room - The selected room.
  31. * @protected
  32. * @returns {void}
  33. */
  34. _onJoin(room) {
  35. const { dispatch, disabled } = this.props;
  36. !disabled && room && dispatch(appNavigate(room));
  37. }
  38. /**
  39. * Creates a bound onPress action for the list item.
  40. *
  41. * @param {string} room - The selected room.
  42. * @protected
  43. * @returns {Function}
  44. */
  45. _onSelect(room) {
  46. return this._onJoin.bind(this, room);
  47. }
  48. }
  49. /**
  50. * Maps (parts of) the redux state into {@code AbstractRecentList}'s React
  51. * {@code Component} props.
  52. *
  53. * @param {Object} state - The redux state.
  54. * @returns {{
  55. * _defaultURL: string,
  56. * _recentList: Array
  57. * }}
  58. */
  59. export function _mapStateToProps(state: Object) {
  60. return {
  61. _defaultURL: state['features/app'].app._getDefaultURL(),
  62. _recentList: state['features/recent-list']
  63. };
  64. }