2017-08-22 17:28:31 +00:00
|
|
|
/* @flow */
|
|
|
|
|
2016-10-05 14:36:59 +00:00
|
|
|
import { isRoomValid } from '../base/conference';
|
2017-01-29 01:56:35 +00:00
|
|
|
import { RouteRegistry } from '../base/react';
|
2017-09-01 21:25:48 +00:00
|
|
|
import { toState } from '../base/redux';
|
2016-10-05 14:36:59 +00:00
|
|
|
import { Conference } from '../conference';
|
2017-09-01 04:13:59 +00:00
|
|
|
import { WelcomePage } from '../welcome';
|
2016-10-05 14:36:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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}
|
|
|
|
*/
|
2017-08-22 17:28:31 +00:00
|
|
|
export function _getRouteToRender(stateOrGetState: Object | Function) {
|
2017-09-01 21:25:48 +00:00
|
|
|
const { room } = toState(stateOrGetState)['features/base/conference'];
|
|
|
|
const component = isRoomValid(room) ? Conference : WelcomePage;
|
2017-06-09 10:30:59 +00:00
|
|
|
|
2016-10-05 14:36:59 +00:00
|
|
|
return RouteRegistry.getRouteByComponent(component);
|
|
|
|
}
|