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';
|
2016-10-05 14:36:59 +00:00
|
|
|
import { Conference } from '../conference';
|
2017-08-22 17:28:31 +00:00
|
|
|
import { Entryway } 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) {
|
2016-10-05 14:36:59 +00:00
|
|
|
const state
|
|
|
|
= typeof stateOrGetState === 'function'
|
2017-01-13 22:37:53 +00:00
|
|
|
? stateOrGetState()
|
|
|
|
: stateOrGetState;
|
2017-05-09 05:15:43 +00:00
|
|
|
const { room } = state['features/base/conference'];
|
2017-08-22 17:28:31 +00:00
|
|
|
const component = isRoomValid(room) ? Conference : Entryway;
|
2017-06-09 10:30:59 +00:00
|
|
|
|
2016-10-05 14:36:59 +00:00
|
|
|
return RouteRegistry.getRouteByComponent(component);
|
|
|
|
}
|