jiti-meet/react/features/app/functions.native.js

39 lines
1.3 KiB
JavaScript
Raw Normal View History

import { isRoomValid } from '../base/conference';
import { RouteRegistry } from '../base/react';
import { Conference } from '../conference';
import { BlankWelcomePage, WelcomePage } from '../welcome';
/**
* Determines which route is to be rendered in order to depict a specific Redux
* store.
*
* @param {(Object|Function)} stateOrGetState - Redux state or Regux getState()
* method.
* @returns {Route}
*/
export function _getRouteToRender(stateOrGetState) {
const state
= typeof stateOrGetState === 'function'
2017-01-13 22:37:53 +00:00
? stateOrGetState()
: stateOrGetState;
const { room } = state['features/base/conference'];
2017-06-09 19:09:23 +00:00
let component;
if (isRoomValid(room)) {
component = Conference;
} else {
// The value of the App prop welcomePageEnabled was stored in redux in
// saghul's PR. But I removed the redux state, action, action type, etc.
// because I didn't like the name. We are not using the prop is a
// React-ive way anyway so it's all the same difference.
const { app } = state['features/app'];
component
= app && app.props.welcomePageEnabled
? WelcomePage
: BlankWelcomePage;
}
return RouteRegistry.getRouteByComponent(component);
}