Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
adds.forEach((component) => {
switch (component) {
case componentNames.SIDE_PANEL_SETTINGS:
AppActions.hideComponent([componentNames.SIDE_PANEL_HELP]);
break;
case componentNames.SIDE_PANEL_HELP:
AppActions.hideComponent([componentNames.SIDE_PANEL_SETTINGS]);
break;
case componentNames.SIDE_PANEL_SETTINGS_STRING_MATCH + componentNames.SPS_INTRO_SPLASH:
if (this.visibleComponents.indexOf(componentNames.INTRO) < 0) {
AppActions.showComponent([componentNames.INTRO]);
}
break;
}
});
updateAppState() {
this.appState = AppStore.getState();
const currentLayout = lang.getObject('appState.items.app.data.values.settings.layout.id',false,this);
if (!this.checkedAdminPanel && !lang.getObject('appState.mode.isMobile',false,this) && !lang.getObject('appState.mode.isBuilder',false,this) && lang.getObject('appState.user.editor',false,this)) {
this.checkedAdminPanel = true;
AppActions.showComponent(componentNames.ADMIN_BANNER);
}
if (lang.getObject('appState.mode.isMobile',false,this) && lang.getObject('appState.app.layout.visibleComponents',false,this).indexOf(componentNames.ADMIN_BANNER) >= 0) {
this.checkedAdminPanel = false;
AppActions.hideComponent(componentNames.ADMIN_BANNER);
}
if (!this.resizedViewer && lang.getObject('appState.app.loading.data',false,this)) {
this.resizeViewer();
}
if (this.resizeViewer) {
this.resizeViewer();
}
if (!this.resizedViewer && lang.getObject('appState.app.loading.map',false,this)) {
this.resizedViewer = true;
}
}
break;
}
});
} else if (isMobile && visibleComponents.indexOf(componentNames.MAP) >= 0 && visibleComponents.indexOf(componentNames.GALLERY) >= 0) {
this.prevVisibleComponents = [].concat(this.visibleComponents);
this.visibleComponents = [].concat(visibleComponents);
this.showMap(options);
AppActions.hideComponent(componentNames.GALLERY);
} else if (!isMobile &&
((visibleComponents.indexOf(componentNames.MAP) >= 0 && visibleComponents.indexOf(componentNames.GALLERY) < 0) ||
(visibleComponents.indexOf(componentNames.MAP) < 0 && visibleComponents.indexOf(componentNames.GALLERY) >= 0))) {
AppActions.showComponent([componentNames.MAP,componentNames.GALLERY]);
}
}
MapActions.selectFeature(false);
AppActions.hideComponent([componentNames.MAP,componentNames.GALLERY,componentNames.SELECTED_SHARES]);
break;
case componentNames.MAP:
this.showMap(options);
const hideComponents = [componentNames.INTRO];
const showComponents = [];
if (isMobile) {
hideComponents.push(componentNames.GALLERY);
} else {
showComponents.push(componentNames.GALLERY);
}
AppActions.hideComponent(hideComponents);
if (showComponents.length > 0) {
AppActions.showComponent(showComponents);
}
break;
case componentNames.GALLERY:
if (this.visibleComponents.indexOf(componentNames.CONTRIBUTE) < 0) {
this.showGallery(options);
const hideComponents = [componentNames.INTRO];
const showComponents = [];
if (isMobile) {
hideComponents.push(componentNames.MAP);
} else {
showComponents.push(componentNames.MAP);
}
AppActions.hideComponent(hideComponents);
if (showComponents.length > 0) {
AppActions.showComponent(showComponents);
setTimeout(() => {
AppActions.showComponent([componentNames.SIDE_PANEL_SETTINGS,componentNames.SIDE_PANEL_SETTINGS_STRING_MATCH + componentNames.SPS_INTRO_SPLASH]);
},1000);
}