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.INTRO:
this.showIntro(options);
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;
removes.forEach((component) => {
switch (component) {
case componentNames.INTRO:
this.hideIntro(options);
if (this.visibleComponents.indexOf(componentNames.MAP) < 0 && this.visibleComponents.indexOf(componentNames.GALLERY) < 0 ) {
if (isMobile) {
AppActions.showComponent(componentNames.MAP);
} else {
AppActions.showComponent([componentNames.MAP,componentNames.GALLERY]);
}
}
break;
}
});
} else if (isMobile && visibleComponents.indexOf(componentNames.MAP) >= 0 && visibleComponents.indexOf(componentNames.GALLERY) >= 0) {
adds.forEach((component) => {
switch (component) {
case componentNames.INTRO:
this.showIntro(options);
MapActions.selectFeature(false);
AppActions.hideComponent([componentNames.MAP,componentNames.GALLERY,componentNames.SELECTED_SHARES]);
break;
case componentNames.MAP:
this.showMap(options);
AppActions.hideComponent([componentNames.INTRO,componentNames.GALLERY]);
break;
case componentNames.GALLERY:
if (this.visibleComponents.indexOf(componentNames.CONTRIBUTE) < 0) {
this.showGallery(options);
AppActions.hideComponent([componentNames.INTRO,componentNames.MAP]);
} else {
AppActions.hideComponent(componentNames.GALLERY);
}
break;
}
});
get mobileNavigationButtons() {
if (this.props.contributing.active) {
return false;
}
if (this.props.components.contribute.participationAllowed && this.props.loading.map && !this.props.contributing.active) {
return [
{
name: viewerText.mobile.bottomNav.home,
icon: 'home',
active: this.props.layout.visibleComponents.indexOf(componentNames.CONTRIBUTE) < 0 && this.props.layout.visibleComponents.indexOf(componentNames.INTRO) >= 0,
action: this.props.showComponent.bind(this,componentNames.INTRO)
},{
name: viewerText.mobile.bottomNav.map,
icon: 'map',
active: this.props.layout.visibleComponents.indexOf(componentNames.CONTRIBUTE) < 0 && this.props.layout.visibleComponents.indexOf(componentNames.MAP) >= 0,
action: this.props.showComponent.bind(this,componentNames.MAP)
},{
name: viewerText.mobile.bottomNav.gallery,
icon: 'gallery',
active: this.props.layout.visibleComponents.indexOf(componentNames.CONTRIBUTE) < 0 && this.props.layout.visibleComponents.indexOf(componentNames.GALLERY) >= 0,
action: this.props.showComponent.bind(this,componentNames.GALLERY)
},{
name: viewerText.mobile.bottomNav.participate,
icon: 'participate',
active: this.props.layout.visibleComponents.indexOf(componentNames.CONTRIBUTE) >= 0,
action: this.props.updateContributeState.bind(this,{active: true})
}
];
}
return [
} else {
AppActions.showComponent([componentNames.MAP,componentNames.GALLERY]);
}
}
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]);
}
}
action: this.props.updateContributeState.bind(this,{active: true})
}
];
}
return [
{
name: viewerText.mobile.bottomNav.home,
icon: 'home',
active: this.props.layout.visibleComponents.indexOf(componentNames.CONTRIBUTE) < 0 && this.props.layout.visibleComponents.indexOf(componentNames.INTRO) >= 0,
action: this.props.showComponent.bind(this,componentNames.INTRO)
},{
name: viewerText.mobile.bottomNav.map,
icon: 'map',
active: this.props.layout.visibleComponents.indexOf(componentNames.CONTRIBUTE) < 0 && this.props.layout.visibleComponents.indexOf(componentNames.MAP) >= 0,
action: this.props.showComponent.bind(this,componentNames.MAP)
},{
name: viewerText.mobile.bottomNav.gallery,
icon: 'gallery',
active: this.props.layout.visibleComponents.indexOf(componentNames.CONTRIBUTE) < 0 && this.props.layout.visibleComponents.indexOf(componentNames.GALLERY) >= 0,
action: this.props.showComponent.bind(this,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);
}
} else {
AppActions.hideComponent(componentNames.GALLERY);
}
break;
}
});