2016-12-12 21:13:17 +00:00
|
|
|
/* global APP */
|
2017-01-10 21:55:31 +00:00
|
|
|
|
2017-01-29 01:56:35 +00:00
|
|
|
import { RouteRegistry } from '../base/react';
|
2016-12-12 21:13:17 +00:00
|
|
|
import { generateRoomWithoutSeparator } from '../base/util';
|
2017-01-10 21:55:31 +00:00
|
|
|
|
2016-10-05 14:36:59 +00:00
|
|
|
import { WelcomePage } from './components';
|
|
|
|
|
2017-01-10 21:55:31 +00:00
|
|
|
/**
|
|
|
|
* Register route for WelcomePage.
|
|
|
|
*/
|
|
|
|
RouteRegistry.register({
|
|
|
|
component: WelcomePage,
|
|
|
|
onEnter,
|
|
|
|
path: '/'
|
|
|
|
});
|
2016-12-12 21:13:17 +00:00
|
|
|
|
|
|
|
/**
|
2017-01-10 21:55:31 +00:00
|
|
|
* If the Welcome page/screen is disabled, generates a (random) room (name) so
|
|
|
|
* that the Welcome page/screen is skipped and the Conference page/screen is
|
|
|
|
* presented instead.
|
2016-12-12 21:13:17 +00:00
|
|
|
*
|
2017-01-10 21:55:31 +00:00
|
|
|
* @param {Object} nextState - The next Router state.
|
|
|
|
* @param {Function} replace - The function to redirect to another path.
|
2016-12-12 21:13:17 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
function onEnter(nextState, replace) {
|
2017-01-10 21:55:31 +00:00
|
|
|
if (typeof APP !== 'undefined' && !APP.settings.isWelcomePageEnabled()) {
|
|
|
|
const room = generateRoomWithoutSeparator();
|
2016-12-12 21:13:17 +00:00
|
|
|
|
2017-01-10 21:55:31 +00:00
|
|
|
replace(`/${room}`);
|
2016-12-12 21:13:17 +00:00
|
|
|
}
|
|
|
|
}
|