feat(UI): simplify code (#2847)

Avoid branching on the same condition and remove unneeded showToolbar call on
filmstrip only mode.
This commit is contained in:
Saúl Ibarra Corretgé 2018-04-24 20:36:56 +02:00 committed by virtuacoplenny
parent 9cbcbf6e26
commit d7103c1c4c
1 changed files with 15 additions and 19 deletions

View File

@ -340,33 +340,29 @@ UI.start = function() {
VideoLayout.resizeVideoArea(true, true);
sharedVideoManager = new SharedVideoManager(eventEmitter);
// eslint-disable-next-line no-negated-condition
if (!interfaceConfig.filmStripOnly) {
if (interfaceConfig.filmStripOnly) {
$('body').addClass('filmstrip-only');
Filmstrip.setFilmstripOnly();
APP.store.dispatch(setNotificationsEnabled(false));
} else {
// Initialise the recording module.
if (config.enableRecording) {
Recording.init(eventEmitter, config.recordingType);
}
config.enableRecording
&& Recording.init(eventEmitter, config.recordingType);
// Initialize side panels
SidePanels.init(eventEmitter);
} else {
$('body').addClass('filmstrip-only');
UI.showToolbar();
Filmstrip.setFilmstripOnly();
APP.store.dispatch(setNotificationsEnabled(false));
}
if (interfaceConfig.VERTICAL_FILMSTRIP) {
$('body').addClass('vertical-filmstrip');
}
// TODO: remove this class once the old toolbar has been removed. This class
// is set so that any CSS changes needed to adjust elements outside of the
// new toolbar can be scoped to just the app with the new toolbar enabled.
if (!interfaceConfig.filmStripOnly) {
// TODO: remove this class once the old toolbar has been removed. This
// class is set so that any CSS changes needed to adjust elements
// outside of the new toolbar can be scoped to just the app with the new
// toolbar enabled.
$('body').addClass('use-new-toolbox');
}
interfaceConfig.VERTICAL_FILMSTRIP
&& $('body').addClass('vertical-filmstrip');
document.title = interfaceConfig.APP_NAME;
};