Fix detached chart window close and attach behavior

This commit is contained in:
litoral05
2026-05-28 08:37:00 +01:00
parent ffe3c64cfa
commit c54c2c6518
8 changed files with 1214 additions and 320 deletions
+14 -19
View File
@@ -7,6 +7,7 @@ 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 { ChartWindowPage } from "../features/maincharts/pages/ChartWindowPage";
import { SettingsPage } from "../features/settings/pages/SettingsPage";
export type AppPage =
@@ -15,15 +16,11 @@ export type AppPage =
| "console"
| "maincharts"
| "settings"
// CLIMATE
| "climate"
| "climateCharts"
| "climateLighting"
| "climateVentilation"
| "climateSynoptic"
// IRRIGATION
| "irrigation"
| "irrigationCharts"
| "irrigationFilters"
@@ -32,35 +29,33 @@ export type AppPage =
| "irrigationSynoptic";
function App() {
const [activePage, setActivePage] =
useState<AppPage>("dashboard");
const [activePage, setActivePage] = useState<AppPage>("dashboard");
const isChartWindow = window.location.pathname.startsWith("/chart-window/");
if (isChartWindow) {
return <ChartWindowPage theme="dark" />;
}
return (
<AppShell
activePage={activePage}
onNavigate={setActivePage}
>
<AppShell activePage={activePage} onNavigate={setActivePage}>
{({ theme }) => {
if (activePage === "meteo") {
return <MeteoPage theme={theme} />;
}
if (activePage === "meteo") return <MeteoPage theme={theme} />;
if (activePage === "climateCharts") {
return <ClimateChartsPage theme={theme} />;
}
if (activePage === "console") {
return <ConsolePage theme={theme} />;
}
if (activePage === "console") return <ConsolePage theme={theme} />;
if (activePage === "maincharts") {
return <MainChartsPage theme={theme} />;
}
if (activePage === "settings") {
return <SettingsPage theme={theme} />
return <SettingsPage theme={theme} />;
}
return (
<DashboardPage
theme={theme}