feat(charts): add persistent workspace chart management
This commit is contained in:
+58
-9
@@ -1,25 +1,74 @@
|
||||
import { useState } from "react";
|
||||
|
||||
import { AppShell } from "../components/layout/AppShell";
|
||||
|
||||
import { DashboardPage } from "../features/dashboard/pages/DashboardPage";
|
||||
import { MeteoPage } from "../features/meteo/pages/MeteoPage";
|
||||
import { ClimateChartsPage } from "../features/climate/pages/ClimateChartsPage";
|
||||
import { ConsolePage } from "../features/console/pages/ConsolePage";
|
||||
import { MainChartsPage } from "../features/maincharts/pages/MainChartsPage";
|
||||
import { SettingsPage } from "../features/settings/pages/SettingsPage";
|
||||
|
||||
export type AppPage = "dashboard" | "meteo";
|
||||
export type AppPage =
|
||||
| "dashboard"
|
||||
| "meteo"
|
||||
| "console"
|
||||
| "maincharts"
|
||||
| "settings"
|
||||
|
||||
// CLIMATE
|
||||
| "climate"
|
||||
| "climateCharts"
|
||||
| "climateLighting"
|
||||
| "climateVentilation"
|
||||
| "climateSynoptic"
|
||||
|
||||
// IRRIGATION
|
||||
| "irrigation"
|
||||
| "irrigationCharts"
|
||||
| "irrigationFilters"
|
||||
| "irrigationConsumption"
|
||||
| "irrigationDrainage"
|
||||
| "irrigationSynoptic";
|
||||
|
||||
function App() {
|
||||
const [activePage, setActivePage] = useState<AppPage>("dashboard");
|
||||
const [activePage, setActivePage] =
|
||||
useState<AppPage>("dashboard");
|
||||
|
||||
return (
|
||||
<AppShell activePage={activePage} onNavigate={setActivePage}>
|
||||
{({ theme }) =>
|
||||
activePage === "meteo" ? (
|
||||
<MeteoPage theme={theme} />
|
||||
) : (
|
||||
<AppShell
|
||||
activePage={activePage}
|
||||
onNavigate={setActivePage}
|
||||
>
|
||||
{({ theme }) => {
|
||||
if (activePage === "meteo") {
|
||||
return <MeteoPage theme={theme} />;
|
||||
}
|
||||
|
||||
if (activePage === "climateCharts") {
|
||||
return <ClimateChartsPage theme={theme} />;
|
||||
}
|
||||
|
||||
|
||||
if (activePage === "console") {
|
||||
return <ConsolePage theme={theme} />;
|
||||
}
|
||||
|
||||
if (activePage === "maincharts") {
|
||||
return <MainChartsPage theme={theme} />;
|
||||
}
|
||||
|
||||
if (activePage === "settings") {
|
||||
return <SettingsPage theme={theme} />
|
||||
}
|
||||
return (
|
||||
<DashboardPage
|
||||
theme={theme}
|
||||
onOpenMeteo={() => setActivePage("meteo")}
|
||||
onNavigate={setActivePage}
|
||||
/>
|
||||
)
|
||||
}
|
||||
);
|
||||
}}
|
||||
</AppShell>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user