Skip to content

Commit

Permalink
fix: show projection result only if forest type and panes are available
Browse files Browse the repository at this point in the history
  • Loading branch information
friedjoff committed Mar 18, 2020
1 parent c292da9 commit 1e11dda
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/components/ProjectionResult.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function ProjectionResult() {
projectionResult: state.projectionResult,
}));
const { i18n, t } = useTranslation();
const { forestType } = location;

const panes = [];
panes.push({
Expand All @@ -30,7 +31,7 @@ function ProjectionResult() {
const p = r.projections[r.projections.length - 1];
const icons = [];
const scenarios = [];
if (projectionMode === 'f') {
if (p && projectionMode === 'f') {
if (location.altitudinalZone === p.altitudinalZone) {
icons.push(<EarthTodayIcon key="today" className={styles.iconToday} />);
scenarios.push(t('projectionScenario.today'));
Expand Down Expand Up @@ -81,9 +82,9 @@ function ProjectionResult() {
}
});

return (
return forestType ? (
<div className={styles.container}>
{panes.length > 0 ? (
{panes.length > 1 ? (
<Tab
className={styles.tab}
menu={{
Expand All @@ -101,7 +102,7 @@ function ProjectionResult() {
</Header>
)}
</div>
);
) : null;
}

export default ProjectionResult;

0 comments on commit 1e11dda

Please sign in to comment.