2018-10-22 13:49:18 -05:00
|
|
|
import React from 'react';
|
|
|
|
|
|
2023-03-27 11:34:33 +03:00
|
|
|
import { createRecentClickedEvent, createRecentSelectedEvent } from '../../analytics/AnalyticsEvents';
|
|
|
|
|
import { sendAnalytics } from '../../analytics/functions';
|
2020-06-04 16:09:13 +02:00
|
|
|
import { appNavigate } from '../../app/actions';
|
2023-03-27 11:34:33 +03:00
|
|
|
import { IStore } from '../../app/types';
|
|
|
|
|
import AbstractPage from '../../base/react/components/AbstractPage';
|
2023-04-03 16:33:18 +03:00
|
|
|
import { Container, Text } from '../../base/react/components/index';
|
2018-10-22 13:49:18 -05:00
|
|
|
|
2023-03-27 11:34:33 +03:00
|
|
|
// @ts-ignore
|
2018-10-22 13:49:18 -05:00
|
|
|
import styles from './styles';
|
|
|
|
|
|
|
|
|
|
/**
|
2021-11-04 22:10:43 +01:00
|
|
|
* The type of the React {@code Component} props of {@link AbstractRecentList}.
|
2018-10-22 13:49:18 -05:00
|
|
|
*/
|
2023-04-03 11:09:50 +03:00
|
|
|
interface IProps {
|
2018-10-22 13:49:18 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The redux store's {@code dispatch} function.
|
|
|
|
|
*/
|
2023-03-27 11:34:33 +03:00
|
|
|
dispatch: IStore['dispatch'];
|
2018-10-22 13:49:18 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The translate function.
|
|
|
|
|
*/
|
2023-03-27 11:34:33 +03:00
|
|
|
t: Function;
|
2023-04-03 11:09:50 +03:00
|
|
|
}
|
2018-10-22 13:49:18 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* An abstract component for the recent list.
|
|
|
|
|
*
|
|
|
|
|
*/
|
2023-04-03 11:09:50 +03:00
|
|
|
export default class AbstractRecentList<P extends IProps> extends AbstractPage<P> {
|
2018-10-22 13:49:18 -05:00
|
|
|
/**
|
|
|
|
|
* 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());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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 14:48:44 +02:00
|
|
|
const descriptionId = 'meetings-list-empty-description';
|
2018-10-22 13:49:18 -05:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Container
|
2021-06-10 14:48:44 +02:00
|
|
|
aria-describedby = { descriptionId }
|
|
|
|
|
aria-label = { t('welcomepage.recentList') }
|
2018-10-22 13:49:18 -05:00
|
|
|
className = 'meetings-list-empty'
|
2021-06-10 14:48:44 +02:00
|
|
|
role = 'region'
|
2018-10-22 13:49:18 -05:00
|
|
|
style = { styles.emptyListContainer }>
|
|
|
|
|
<Text
|
|
|
|
|
className = 'description'
|
2021-06-10 14:48:44 +02:00
|
|
|
id = { descriptionId }
|
2018-10-22 13:49:18 -05:00
|
|
|
style = { styles.emptyListText }>
|
|
|
|
|
{ t('welcomepage.recentListEmpty') }
|
|
|
|
|
</Text>
|
|
|
|
|
</Container>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Handles the list's navigate action.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {string} url - The url string to navigate to.
|
|
|
|
|
* @returns {void}
|
|
|
|
|
*/
|
2023-03-27 11:34:33 +03:00
|
|
|
_onPress(url: string) {
|
2018-10-22 13:49:18 -05:00
|
|
|
const { dispatch } = this.props;
|
|
|
|
|
|
2021-11-09 12:20:40 +02:00
|
|
|
sendAnalytics(createRecentClickedEvent('meeting.tile'));
|
2018-10-22 13:49:18 -05:00
|
|
|
|
|
|
|
|
dispatch(appNavigate(url));
|
|
|
|
|
}
|
|
|
|
|
}
|