Added UI with station cards, grouping and styling

This commit is contained in:
2026-05-07 23:22:05 +02:00
parent 02392b8c24
commit 02c1a4c58c
9 changed files with 444 additions and 8 deletions
+19
View File
@@ -0,0 +1,19 @@
export async function fetchStations() {
const res = await fetch('/api/campagne_map_data');
if (!res.ok) throw new Error(`Errore HTTP ${res.status}`);
const geojson = await res.json();
return geojson.features
.map(f => ({ ...f.properties, pk: parseInt(f.properties.pk, 10) }))
.sort((a, b) => b.pk - a.pk);
}
export async function fetchDay(id, date) {
try {
const res = await fetch(`/api/get_measurements/${id}?day=${date}`);
if (!res.ok) return [];
const data = await res.json();
return data.misure ?? [];
} catch {
return [];
}
}