Stations: a page of its own, under Data (the tracked stations, their position, the pumping), instead of the window of the selector

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-17 08:59:51 +01:00
1 parent c8c8c1587a
commit d72dccb14e
4 files changed
+97 -85

No files matched your search

+8 -4
View File
@@ -3,10 +3,11 @@ import {
ActionIcon, AppShell, Burger, ColorSwatch, Group, Loader, NavLink, ScrollArea, Text, Tooltip, useComputedColorScheme, useMantineColorScheme,
} from "@mantine/core";
import { useDisclosure } from "@mantine/hooks";
import { IconChartLine, IconFolder, IconMoon, IconSun } from "@tabler/icons-react";
import { IconChartLine, IconFolder, IconMoon, IconSatellite, IconSun } from "@tabler/icons-react";
const Data = lazy(() => import("./pages/Data.jsx")); // Plotly, loaded only here
const PAGES = [["data", "Data", IconChartLine]];
const Stations = lazy(() => import("./pages/Stations.jsx"));
const PAGES = [["data", "Data", IconChartLine], ["stations", "Stations", IconSatellite]];
// The address: #/<page>?station=…&start=…&end=…; reloading keeps the page and the selection, Back works; without dates, the
// last 5 UTC days, today included (end excluded: tomorrow)
@@ -113,7 +114,7 @@ export default function App() {
return () => removeEventListener("hashchange", follow);
}, []);
// the same address again (Load, the end of a pumping): read again, a new selection loads the data again
// the same address again (Load): read again, a new selection loads the data again
const choose = s => { const a = address(page, s); if (location.hash === a) setPlace(readAddress()); else location.hash = a; };
// An analysis of the sidebar: Data on its station, days that cover its range (unless the range shown already covers them)
function openAnalysis(a) {
@@ -128,7 +129,10 @@ export default function App() {
<Header mobile={mobile} desktop={desktop} toggle={{ mobile: toggleMobile, desktop: toggleDesktop }} />
<Sidebar page={page} selection={selection} close={closeMobile} open={openAnalysis} />
<AppShell.Main bg="var(--mantine-color-default-hover)">
<Suspense fallback={<Loader m="xl" />}><Data selection={selection} choose={choose} analysis={analysis} setAnalysis={setAnalysis} /></Suspense>
<Suspense fallback={<Loader m="xl" />}>
{page === "stations" ? <Stations selection={selection} />
: <Data selection={selection} choose={choose} analysis={analysis} setAnalysis={setAnalysis} />}
</Suspense>
</AppShell.Main>
</AppShell>
);