Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide tree options when tree is off #1698

Merged
merged 2 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 20 additions & 15 deletions src/components/controls/controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ import { AnnotatedHeader } from "./annotatedHeader";
import MeasurementsOptions from "./measurementsOptions";

type Props = {
treeOn: boolean
mapOn: boolean
frequenciesOn: boolean
measurementsOn: boolean
mobileDisplay: boolean
}

function Controls({ mapOn, frequenciesOn, measurementsOn, mobileDisplay }: Props) {
function Controls({ treeOn, mapOn, frequenciesOn, measurementsOn, mobileDisplay }: Props) {
const { t } = useTranslation();

return (
Expand All @@ -50,36 +51,40 @@ function Controls({ mapOn, frequenciesOn, measurementsOn, mobileDisplay }: Props
<AnnotatedHeader title={t("sidebar:Filter Data")} tooltip={FilterInfo} mobile={mobileDisplay}/>
<FilterData measurementsOn={measurementsOn} />

<AnnotatedHeader title={t("sidebar:Tree Options")} tooltip={TreeOptionsInfo} mobile={mobileDisplay}/>
<ChooseLayout />
<ChooseMetric />
<ChooseBranchLabelling />
<ChooseTipLabel />
<ChooseSecondTree />
<ChooseExplodeAttr tooltip={ExplodeTreeInfo} mobile={mobileDisplay} />
<ToggleTangle />
{treeOn &&
<span>
<AnnotatedHeader title={t("sidebar:Tree Options")} tooltip={TreeOptionsInfo} mobile={mobileDisplay}/>
<ChooseLayout />
<ChooseMetric />
<ChooseBranchLabelling />
<ChooseTipLabel />
<ChooseSecondTree />
<ChooseExplodeAttr tooltip={ExplodeTreeInfo} mobile={mobileDisplay} />
<ToggleTangle />
</span>
}

{measurementsOn ? (
{measurementsOn &&
<span style={{ marginTop: "10px" }}>
<AnnotatedHeader title={t("sidebar:Measurements Options")} tooltip={MeasurementsOptionsInfo} mobile={mobileDisplay}/>
<MeasurementsOptions />
</span>
) : null}
}

{mapOn ? (
{mapOn &&
<span style={{ marginTop: "10px" }}>
<AnnotatedHeader title={t("sidebar:Map Options")} tooltip={MapOptionsInfo} mobile={mobileDisplay}/>
<GeoResolution />
<TransmissionLines />
</span>
) : null}
}

{frequenciesOn ? (
{frequenciesOn &&
<span style={{ marginTop: "10px" }}>
<AnnotatedHeader title={t("sidebar:Frequency Options")} tooltip={FrequencyInfo} mobile={mobileDisplay}/>
<NormalizeFrequencies />
</span>
) : null}
}

<span style={{ marginTop: "10px" }}>
<AnnotatedHeader title={t("sidebar:Animation Options")} tooltip={AnimationOptionsInfo} mobile={mobileDisplay}/>
Expand Down
1 change: 1 addition & 0 deletions src/components/main/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const Sidebar = (
) : (
<Controls
mobileDisplay={mobileDisplay}
treeOn={panelsToDisplay.includes("tree")}
mapOn={panelsToDisplay.includes("map")}
frequenciesOn={panelsToDisplay.includes("frequencies")}
measurementsOn={panelsToDisplay.includes("measurements")}
Expand Down
Loading