2018-10-22 18:49:18 +00:00
|
|
|
// @flow
|
2019-03-19 15:42:25 +00:00
|
|
|
|
2018-10-22 18:49:18 +00:00
|
|
|
import React from 'react';
|
2019-03-19 15:42:25 +00:00
|
|
|
import type { Dispatch } from 'redux';
|
2018-10-22 18:49:18 +00:00
|
|
|
|
|
|
|
import {
|
|
|
|
createRecentClickedEvent,
|
|
|
|
createRecentSelectedEvent,
|
|
|
|
sendAnalytics
|
|
|
|
} from '../../analytics';
|
2020-06-04 14:09:13 +00:00
|
|
|
import { appNavigate } from '../../app/actions';
|
2018-10-22 18:49:18 +00:00
|
|
|
import {
|
|
|
|
AbstractPage,
|
|
|
|
Container,
|
|
|
|
Text
|
|
|
|
} from '../../base/react';
|
|
|
|
|
|
|
|
import styles from './styles';
|
|
|
|
|
|
|
|
/**
|
2021-11-04 21:10:43 +00:00
|
|
|
* The type of the React {@code Component} props of {@link AbstractRecentList}.
|
2018-10-22 18:49:18 +00:00
|
|
|
*/
|
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The redux store's {@code dispatch} function.
|
|
|
|
*/
|
2019-03-19 15:42:25 +00:00
|
|
|
dispatch: Dispatch<any>,
|
2018-10-22 18:49:18 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The translate function.
|
|
|
|
*/
|
|
|
|
t: Function
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* An abstract component for the recent list.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
export default class AbstractRecentList<P: Props> extends AbstractPage<P> {
|
|
|
|
/**
|
|
|
|
* Initializes a new {@code RecentList} instance.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
constructor(props: P) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this._onPress = this._onPress.bind(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#componentDidMount()}. Invoked
|
|
|
|
* immediately after this component is mounted.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
componentDidMount() {
|
|
|
|
sendAnalytics(createRecentSelectedEvent());
|
|
|
|
}
|
|
|
|
|
|
|
|
_getRenderListEmptyComponent: () => React$Node;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a list empty component if a custom one has to be rendered instead
|
|
|
|
* of the default one in the {@link NavigateSectionList}.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {React$Component}
|
|
|
|
*/
|
|
|
|
_getRenderListEmptyComponent() {
|
|
|
|
const { t } = this.props;
|
2021-06-10 12:48:44 +00:00
|
|
|
const descriptionId = 'meetings-list-empty-description';
|
2018-10-22 18:49:18 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Container
|
2021-06-10 12:48:44 +00:00
|
|
|
aria-describedby = { descriptionId }
|
|
|
|
aria-label = { t('welcomepage.recentList') }
|
2018-10-22 18:49:18 +00:00
|
|
|
className = 'meetings-list-empty'
|
2021-06-10 12:48:44 +00:00
|
|
|
role = 'region'
|
2018-10-22 18:49:18 +00:00
|
|
|
style = { styles.emptyListContainer }>
|
|
|
|
<Text
|
|
|
|
className = 'description'
|
2021-06-10 12:48:44 +00:00
|
|
|
id = { descriptionId }
|
2018-10-22 18:49:18 +00:00
|
|
|
style = { styles.emptyListText }>
|
|
|
|
{ t('welcomepage.recentListEmpty') }
|
|
|
|
</Text>
|
|
|
|
</Container>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-08-15 14:54:31 +00:00
|
|
|
_onPress: string => void;
|
2018-10-22 18:49:18 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles the list's navigate action.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @param {string} url - The url string to navigate to.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onPress(url) {
|
|
|
|
const { dispatch } = this.props;
|
|
|
|
|
2021-11-09 10:20:40 +00:00
|
|
|
sendAnalytics(createRecentClickedEvent('meeting.tile'));
|
2018-10-22 18:49:18 +00:00
|
|
|
|
|
|
|
dispatch(appNavigate(url));
|
|
|
|
}
|
|
|
|
}
|