123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- // @flow
-
- import { Component } from 'react';
-
- import { appNavigate } from '../../app';
-
- /**
- * The type of the React {@code Component} props of {@link AbstractRecentList}
- */
- type Props = {
-
- /**
- * Indicates if the list is disabled or not.
- */
- disabled: boolean,
-
- /**
- * The redux store's {@code dispatch} function.
- */
- dispatch: Dispatch<*>
- };
-
- /**
- * Implements a React {@link Component} which represents the list of conferences
- * recently joined, similar to how a list of last dialed numbers list would do
- * on a mobile device.
- *
- * @extends Component
- */
- export default class AbstractRecentList extends Component<Props> {
-
- /**
- * Joins the selected room.
- *
- * @param {string} room - The selected room.
- * @returns {void}
- */
- _onJoin(room) {
- const { disabled, dispatch } = this.props;
-
- !disabled && room && dispatch(appNavigate(room));
- }
-
- /**
- * Creates a bound onPress action for the list item.
- *
- * @param {string} room - The selected room.
- * @returns {Function}
- */
- _onSelect(room) {
- return this._onJoin.bind(this, room);
- }
- }
-
- /**
- * Maps redux state to component props.
- *
- * @param {Object} state - The redux state.
- * @returns {{
- * _homeServer: string,
- * _recentList: Array
- * }}
- */
- export function _mapStateToProps(state: Object) {
- return {
- _homeServer: state['features/app'].app._getDefaultURL(),
- _recentList: state['features/recent-list'].list
- };
- }
|