2017-08-29 23:30:21 +00:00
|
|
|
/* @flow */
|
|
|
|
|
2017-08-24 15:58:22 +00:00
|
|
|
import PropTypes from 'prop-types';
|
2017-09-01 04:13:59 +00:00
|
|
|
import React, { Component } from 'react';
|
2017-08-24 15:58:22 +00:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
2017-09-01 04:13:59 +00:00
|
|
|
import { destroyLocalTracks } from '../../base/tracks';
|
2017-09-13 12:17:14 +00:00
|
|
|
import { NetworkActivityIndicator } from '../../mobile/network-activity';
|
2017-09-01 04:13:59 +00:00
|
|
|
|
|
|
|
import { isWelcomePageAppEnabled } from '../functions';
|
2017-09-05 22:45:20 +00:00
|
|
|
import LocalVideoTrackUnderlay from './LocalVideoTrackUnderlay';
|
2017-08-24 15:58:22 +00:00
|
|
|
|
|
|
|
/**
|
2017-10-01 06:35:19 +00:00
|
|
|
* The React {@code Component} displayed by {@code AbstractApp} when it has no
|
|
|
|
* {@code Route} to render. Renders a progress indicator when there are ongoing
|
2017-09-01 04:13:59 +00:00
|
|
|
* network requests.
|
2017-08-24 15:58:22 +00:00
|
|
|
*/
|
2017-10-24 22:26:56 +00:00
|
|
|
class BlankPage extends Component<*> {
|
2017-08-24 15:58:22 +00:00
|
|
|
/**
|
2017-10-01 06:35:19 +00:00
|
|
|
* {@code BlankPage} React {@code Component}'s prop types.
|
2017-08-24 15:58:22 +00:00
|
|
|
*
|
|
|
|
* @static
|
|
|
|
*/
|
|
|
|
static propTypes = {
|
2017-09-01 04:13:59 +00:00
|
|
|
/**
|
2017-10-01 06:35:19 +00:00
|
|
|
* The indicator which determines whether {@code WelcomePage} is (to
|
2017-09-01 04:13:59 +00:00
|
|
|
* be) rendered.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
_welcomePageEnabled: PropTypes.bool,
|
|
|
|
|
|
|
|
dispatch: PropTypes.func
|
2017-08-24 15:58:22 +00:00
|
|
|
};
|
|
|
|
|
2017-09-01 04:13:59 +00:00
|
|
|
/**
|
|
|
|
* Destroys the local tracks (if any) since no media is desired when this
|
|
|
|
* component is rendered.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
componentWillMount() {
|
|
|
|
this.props._welcomePageEnabled
|
|
|
|
|| this.props.dispatch(destroyLocalTracks());
|
|
|
|
}
|
|
|
|
|
2017-08-24 15:58:22 +00:00
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
|
|
|
return (
|
2018-02-02 14:50:16 +00:00
|
|
|
<LocalVideoTrackUnderlay>
|
2017-09-13 12:17:14 +00:00
|
|
|
<NetworkActivityIndicator />
|
2017-09-05 22:45:20 +00:00
|
|
|
</LocalVideoTrackUnderlay>
|
2017-08-24 15:58:22 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-10-01 06:35:19 +00:00
|
|
|
* Maps (parts of) the redux state to the React {@code Component} props of
|
|
|
|
* {@code BlankPage}.
|
2017-08-24 15:58:22 +00:00
|
|
|
*
|
|
|
|
* @param {Object} state - The redux state.
|
|
|
|
* @private
|
|
|
|
* @returns {{
|
2017-09-01 04:13:59 +00:00
|
|
|
* _welcomePageEnabled: boolean
|
2017-08-24 15:58:22 +00:00
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
function _mapStateToProps(state) {
|
|
|
|
return {
|
2017-09-01 04:13:59 +00:00
|
|
|
_welcomePageEnabled: isWelcomePageAppEnabled(state)
|
2017-08-24 15:58:22 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default connect(_mapStateToProps)(BlankPage);
|