2017-08-22 12:28:31 -05:00
|
|
|
/* @flow */
|
|
|
|
|
|
2016-10-05 09:36:59 -05:00
|
|
|
import { isRoomValid } from '../base/conference';
|
2017-01-28 19:56:35 -06:00
|
|
|
import { RouteRegistry } from '../base/react';
|
2016-10-05 09:36:59 -05:00
|
|
|
import { Conference } from '../conference';
|
2017-08-22 12:28:31 -05:00
|
|
|
import { Entryway } from '../welcome';
|
2016-10-05 09:36:59 -05: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 12:28:31 -05:00
|
|
|
export function _getRouteToRender(stateOrGetState: Object | Function) {
|
2016-10-05 09:36:59 -05:00
|
|
|
const state
|
|
|
|
|
= typeof stateOrGetState === 'function'
|
2017-01-13 16:37:53 -06:00
|
|
|
? stateOrGetState()
|
|
|
|
|
: stateOrGetState;
|
2017-05-09 00:15:43 -05:00
|
|
|
const { room } = state['features/base/conference'];
|
2017-08-22 12:28:31 -05:00
|
|
|
const component = isRoomValid(room) ? Conference : Entryway;
|
2017-06-09 12:30:59 +02:00
|
|
|
|
2016-10-05 09:36:59 -05:00
|
|
|
return RouteRegistry.getRouteByComponent(component);
|
|
|
|
|
}
|