mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 11:22:31 +00:00
Up until now we relied on implicit loading of middlewares and reducers, through having imports in each feature's index.js. This leads to many complex import cycles which result in (sometimes) hard to fix bugs in addition to (often) breaking mobile because a web-only feature gets imported on mobile too, thanks to the implicit loading. This PR changes that to make the process explicit. Both middlewares and reducers are imported in a single place, the app entrypoint. They have been divided into 3 categories: any, web and native, which represent each of the platforms respectively. Ideally no feature should have an index.js exporting actions, action types and components, but that's a larger ordeal, so this is just the first step in getting there. In order to both set example and avoid large cycles the app feature has been refactored to not have an idex.js itself.
105 lines
2.3 KiB
JavaScript
105 lines
2.3 KiB
JavaScript
// @flow
|
|
|
|
import React from 'react';
|
|
import type { Dispatch } from 'redux';
|
|
|
|
import {
|
|
createRecentClickedEvent,
|
|
createRecentSelectedEvent,
|
|
sendAnalytics
|
|
} from '../../analytics';
|
|
import { appNavigate } from '../../app/actions';
|
|
import {
|
|
AbstractPage,
|
|
Container,
|
|
Text
|
|
} from '../../base/react';
|
|
|
|
import styles from './styles';
|
|
|
|
/**
|
|
* The type of the React {@code Component} props of {@link AbstractRecentList}
|
|
*/
|
|
type Props = {
|
|
|
|
/**
|
|
* The redux store's {@code dispatch} function.
|
|
*/
|
|
dispatch: Dispatch<any>,
|
|
|
|
/**
|
|
* 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;
|
|
|
|
return (
|
|
<Container
|
|
className = 'meetings-list-empty'
|
|
style = { styles.emptyListContainer }>
|
|
<Text
|
|
className = 'description'
|
|
style = { styles.emptyListText }>
|
|
{ t('welcomepage.recentListEmpty') }
|
|
</Text>
|
|
</Container>
|
|
);
|
|
}
|
|
|
|
_onPress: string => void;
|
|
|
|
/**
|
|
* Handles the list's navigate action.
|
|
*
|
|
* @private
|
|
* @param {string} url - The url string to navigate to.
|
|
* @returns {void}
|
|
*/
|
|
_onPress(url) {
|
|
const { dispatch } = this.props;
|
|
|
|
sendAnalytics(createRecentClickedEvent('recent.meeting.tile'));
|
|
|
|
dispatch(appNavigate(url));
|
|
}
|
|
}
|