mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-16 08:07:46 +00:00
I see it as the first step in simplifying the route navigate of the JavaScript app by removing BlankWelcomePage from _getRouteToRender. From a faraway point of view, the app is at the route at which it is not in a conference. Historically, the route was known as the Welcome page. But mobile complicated the route by saying that actually it may not want to see the room name input and join button. Additionally, I renamed BlankWelcomePage to BlankPage because I don't think of it as a WelcomePage alternative but rather as a more generic BlankPage which may be utilized elsewhere in the future. I plan for the next steps to: * Merge Entryway, _interceptComponent, and _getRouteToRender in one React Component rendered by AbstractApp so that the whole logic is in one file; * Get rid of RouteRegistry and routes.
75 lines
2.2 KiB
JavaScript
75 lines
2.2 KiB
JavaScript
import PropTypes from 'prop-types';
|
|
import React, { Component } from 'react';
|
|
import { connect } from 'react-redux';
|
|
|
|
import BlankPage from './BlankPage';
|
|
import WelcomePage from './WelcomePage';
|
|
|
|
/**
|
|
* A React <tt>Component</tt> which is rendered when there is no (valid) room
|
|
* (name) i.e. it is the opposite of <tt>Conference</tt>. Generally and
|
|
* historically, it is <tt>WelcomePage</tt>. However, Jitsi Meet SDK for Android
|
|
* and iOS allows the use of the (JavaScript) app without <tt>WelcomePage</tt>
|
|
* and it needs to display something between conferences.
|
|
*/
|
|
class Entryway extends Component {
|
|
/**
|
|
* <tt>Entryway</tt>'s React <tt>Component</tt> prop types.
|
|
*/
|
|
static propTypes = {
|
|
/**
|
|
* The indicator which determines whether <tt>WelcomePage</tt> is (to
|
|
* be) rendered.
|
|
*
|
|
* @private
|
|
*/
|
|
_welcomePageEnabled: PropTypes.bool
|
|
};
|
|
|
|
/**
|
|
* Implements React's {@link Component#render()}.
|
|
*
|
|
* @inheritdoc
|
|
* @returns {ReactElement}
|
|
*/
|
|
render() {
|
|
return (
|
|
this.props._welcomePageEnabled ? <WelcomePage /> : <BlankPage />
|
|
);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Maps (parts of) the redux state to the associated Entryway's props.
|
|
*
|
|
* @param {Object} state - The redux state.
|
|
* @private
|
|
* @returns {{
|
|
* _welcomePageEnabled: boolean
|
|
* }}
|
|
*/
|
|
function _mapStateToProps(state) {
|
|
let welcomePageEnabled;
|
|
|
|
if (navigator.product === 'ReactNative') {
|
|
// We introduced the welcomePageEnabled prop on App in Jitsi Meet SDK
|
|
// for Android and iOS. There isn't a strong reason not to introduce it
|
|
// on Web but there're a few considerations to be taken before I go
|
|
// there among which:
|
|
// - Enabling/disabling the Welcome page on Web historically
|
|
// automatically redirects to a random room and that does not make sense
|
|
// on mobile (right now).
|
|
const { app } = state['features/app'];
|
|
|
|
welcomePageEnabled = Boolean(app && app.props.welcomePageEnabled);
|
|
} else {
|
|
welcomePageEnabled = true;
|
|
}
|
|
|
|
return {
|
|
_welcomePageEnabled: welcomePageEnabled
|
|
};
|
|
}
|
|
|
|
export default connect(_mapStateToProps)(Entryway);
|