Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

AbstractRecentList.js 1.5KB

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