From 9714d4234bac0ea17c81ee1e00957b1583ab9c4a Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Thu, 5 Oct 2023 11:56:48 -0700 Subject: [PATCH] squash! Move panel toggles to control headers Repurpose and move the section "Panel Options" to the top as "Layout". Conditionally render that entire section including the header. --- src/components/controls/controls.tsx | 16 ++++++++++++---- src/components/controls/miscInfoText.js | 6 ++---- src/components/controls/panel-layout.js | 6 +----- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/components/controls/controls.tsx b/src/components/controls/controls.tsx index b1dbb1396..ec5252a29 100644 --- a/src/components/controls/controls.tsx +++ b/src/components/controls/controls.tsx @@ -21,7 +21,7 @@ import ToggleTangle from "./toggle-tangle"; import Language from "./language"; import { ControlsContainer } from "./styles"; import FilterData, {FilterInfo} from "./filter"; -import {TreeInfo, MapInfo, AnimationOptionsInfo, PanelOptionsInfo, +import {TreeInfo, MapInfo, AnimationOptionsInfo, PanelLayoutInfo, ExplodeTreeInfo, FrequencyInfo, MeasurementsInfo} from "./miscInfoText"; import { AnnotatedHeader } from "./annotatedHeader"; import MeasurementsOptions from "./measurementsOptions"; @@ -34,6 +34,7 @@ interface RootState { panelsAvailable: string[] panelsToDisplay: string[] showTreeToo: boolean + canTogglePanelLayout: boolean } } @@ -49,6 +50,7 @@ function Controls({ treeOn, mapOn, frequenciesOn, measurementsOn, mobileDisplay const { t } = useTranslation(); const panelsAvailable = useSelector((state: RootState) => state.controls.panelsAvailable); + const canTogglePanelLayout = useSelector((state: RootState) => state.controls.canTogglePanelLayout); return ( @@ -64,6 +66,15 @@ function Controls({ treeOn, mapOn, frequenciesOn, measurementsOn, mobileDisplay + {canTogglePanelLayout && + <> + + {/* FIXME: update translations */} + + + + } + {panelsAvailable.includes("tree") && } @@ -132,9 +143,6 @@ function Controls({ treeOn, mapOn, frequenciesOn, measurementsOn, mobileDisplay - - - ); diff --git a/src/components/controls/miscInfoText.js b/src/components/controls/miscInfoText.js index 6d7b76ec4..8ec0777a3 100644 --- a/src/components/controls/miscInfoText.js +++ b/src/components/controls/miscInfoText.js @@ -27,11 +27,9 @@ export const AnimationOptionsInfo = ( ); -export const PanelOptionsInfo = ( +export const PanelLayoutInfo = ( <> - Control which panels are being displayed and whether to show the tree and the map side-by-side (grid) or expanded (full). -
- Note that what options are available here are dataset specific! + Control whether to show the tree and the map side-by-side (grid) or expanded (full). ); diff --git a/src/components/controls/panel-layout.js b/src/components/controls/panel-layout.js index 61df20d95..c2cf1ead5 100644 --- a/src/components/controls/panel-layout.js +++ b/src/components/controls/panel-layout.js @@ -19,16 +19,12 @@ const PanelsGridIcon = withTheme(icons.PanelsGrid); @connect((state) => { return { panelLayout: state.controls.panelLayout, - canTogglePanelLayout: state.controls.canTogglePanelLayout }; }) class PanelLayouts extends React.Component { render() { const { t } = this.props; - // const mapAndTree = this.props.panels !== undefined && this.props.panels.indexOf("map") !== -1 && this.props.panels.indexOf("tree") !== -1; - if (!this.props.canTogglePanelLayout) { - return null; - } + return (