Skip to content
Draft
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
28 changes: 22 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions src/components/controls/MainViewControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,26 @@ import BarChartIcon from "@mui/icons-material/BarChart";

import useStore from "../../store";

const controls = [
const allControls = [
{ id: "display_map", icon: <MapIcon /> },
{ id: "display_chart", icon: <BarChartIcon /> },
];

const MainViewControls = () => {
const { activeViewControl, setActiveViewControl } = useStore();
const { activeViewControl, setActiveViewControl, selectedSubTab } = useStore();
const { t } = useTranslation();

const controls =
selectedSubTab === 1 ? allControls.filter((c) => c.id !== "display_map") : allControls;

const handleSelect = (control) => {
setActiveViewControl(control);
};

return (
<Card
sx={{
// maxWidth: controls.length === 1 ? "50%" : "100%",
maxWidth: "100%",
margin: "auto",
bgcolor: "#FFCCCC",
Expand Down
13 changes: 12 additions & 1 deletion src/components/main/MainSubTabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ import useStore from "../../store";
import { useMapTools } from "../../utils/mapTools";

const MainSubTabs = () => {
const { activeViewControl, selectedSubTab, selectedTab, setSelectedSubTab } = useStore();
const {
activeViewControl,
selectedSubTab,
selectedTab,
setSelectedSubTab,
setActiveViewControl,
} = useStore();
const { handleSaveImage, handleSaveMap, handleAddToOutput } = useMapTools();
const { t } = useTranslation();

Expand All @@ -27,6 +33,11 @@ const MainSubTabs = () => {

const handleSubTabChange = (event, newValue) => {
setSelectedSubTab(newValue);
// Set the active vew to display_chart if Economic & Non-Economic tab is selected.
// The display_map is not currently available for this tab.
if (newValue === 1) {
setActiveViewControl("display_chart");
}
};

const handleButtonClick = (index) => {
Expand Down