diff --git a/src/components/controls/controls.tsx b/src/components/controls/controls.tsx index 0ce8fbb72..3a1f55331 100644 --- a/src/components/controls/controls.tsx +++ b/src/components/controls/controls.tsx @@ -1,4 +1,5 @@ import React from "react"; +import { useSelector } from "react-redux"; import { useTranslation } from 'react-i18next'; import ColorBy, {ColorByInfo} from "./color-by"; @@ -25,18 +26,22 @@ import {TreeOptionsInfo, MapOptionsInfo, AnimationOptionsInfo, PanelOptionsInfo, ExplodeTreeInfo, FrequencyInfo, MeasurementsOptionsInfo} from "./miscInfoText"; import { AnnotatedHeader } from "./annotatedHeader"; import MeasurementsOptions from "./measurementsOptions"; +import { RootState } from "../../store"; type Props = { - treeOn: boolean - mapOn: boolean - frequenciesOn: boolean - measurementsOn: boolean mobileDisplay: boolean } -function Controls({ treeOn, mapOn, frequenciesOn, measurementsOn, mobileDisplay }: Props) { +function Controls({ mobileDisplay }: Props) { const { t } = useTranslation(); + const panelsToDisplay = useSelector((state: RootState) => state.controls.panelsToDisplay); + + const treeOn = panelsToDisplay.includes("tree"); + const mapOn = panelsToDisplay.includes("map"); + const frequenciesOn = panelsToDisplay.includes("frequencies"); + const measurementsOn = panelsToDisplay.includes("measurements"); + return ( diff --git a/src/components/main/index.js b/src/components/main/index.js index 2eeca0b14..0d5234f11 100644 --- a/src/components/main/index.js +++ b/src/components/main/index.js @@ -156,7 +156,6 @@ class Main extends React.Component { width={sidebarWidth} height={availableHeight} displayNarrative={this.props.displayNarrative} - panelsToDisplay={this.props.panelsToDisplay} narrativeTitle={this.props.narrativeTitle} mobileDisplay={this.state.mobileDisplay} navBarHandler={this.toggleSidebar} diff --git a/src/components/main/sidebar.js b/src/components/main/sidebar.js index 6e9bfcd2c..1d23ad42d 100644 --- a/src/components/main/sidebar.js +++ b/src/components/main/sidebar.js @@ -8,7 +8,7 @@ import { narrativeNavBarHeight } from "../../util/globals"; export const Sidebar = ( - {sidebarOpen, width, height, displayNarrative, panelsToDisplay, narrativeTitle, mobileDisplay, navBarHandler} + {sidebarOpen, width, height, displayNarrative, narrativeTitle, mobileDisplay, navBarHandler} ) => { return ( @@ -23,13 +23,7 @@ export const Sidebar = ( {displayNarrative ? ( ) : ( - + )}