English: the app (server/, analysis.py, routes and JSON fields), instructions/analyst.md, docs; the table of shared renames

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-16 12:40:03 +01:00
1 parent 1d80a77cb1
commit a3e6ade845
24 files changed
+1959 -1835

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
import { useEffect, useState } from "react";
import { Button, Card, Group, Select, TextInput } from "@mantine/core";
import { notifications } from "@mantine/notifications";
// A request to the API; a refusal of the server shows as a notification -> the JSON returned, or null
export async function call(path, method = "GET", body) {
try {
const r = await fetch(path, body === undefined ? { method }
: { method, headers: { "Content-Type": "application/json" }, body: JSON.stringify(body) });
const json = await r.json().catch(() => ({ error: r.statusText }));
if (r.ok) return json;
notifications.show({ color: "red", title: "Refused", message: json.error || r.statusText });
} catch (e) {
notifications.show({ color: "red", title: "Server unreachable", message: e.message });
}
return null;
}
// The station and the range (UTC, To excluded; empty: the whole period), shared by the pages through the address
export function Selector({ selection, choose }) {
const [stations, setStations] = useState([]), [s, setS] = useState(selection);
useEffect(() => { call("/api/stations").then(l => l && setStations(l)); }, []);
useEffect(() => setS(selection), [selection.station, selection.start, selection.end]);
return (
<Card shadow="sm" withBorder>
<Group align="flex-end" gap="md">
<Select label="Station" placeholder="Choose" data={stations} value={s.station || null} searchable w={200}
onChange={v => setS({ ...s, station: v || "" })} />
<TextInput label="From (UTC)" type="date" value={s.start} onChange={e => setS({ ...s, start: e.currentTarget.value })} />
<TextInput label="To (excluded)" type="date" value={s.end} onChange={e => setS({ ...s, end: e.currentTarget.value })} />
<Button onClick={() => choose(s)} disabled={!s.station}>Load</Button>
</Group>
</Card>
);
}