diff --git a/frontend/src/components/ApiDocs.jsx b/frontend/src/components/ApiDocs.jsx index 4dbca86..15d9766 100644 --- a/frontend/src/components/ApiDocs.jsx +++ b/frontend/src/components/ApiDocs.jsx @@ -6,12 +6,12 @@ const ApiDocs = ({ json }) => { if (!json) return

No hay documentación disponible.

; const renderEndpoints = (endpoints) => ( - + {endpoints.map((ep, index) => ( - + {ep.method} - {ep.path} + {ep.path} {ep.description &&

{ep.description}

} diff --git a/frontend/src/components/HistoryCharts.jsx b/frontend/src/components/HistoryCharts.jsx index 97831f0..f949659 100644 --- a/frontend/src/components/HistoryCharts.jsx +++ b/frontend/src/components/HistoryCharts.jsx @@ -108,22 +108,23 @@ const HistoryChartsContent = () => { cards={historyData.map(({ title, data, borderColor, backgroundColor }) => ({ title, content: ( - ), styleMode: "override", className: "col-lg-6 col-xxs-12 d-flex flex-column align-items-center", - style: { minHeight: "250px" } + style: { minHeight: "250px", width: '100%' } }))} /> -

El historial muestra datos de los últimos 3 días

+

El historial muestra datos de los últimos 3 días, el mapa del día actual, y arriba del todo los datos son los últimos recogidos independientemente de la fecha

); diff --git a/frontend/src/components/PollutionMap.jsx b/frontend/src/components/PollutionMap.jsx index 73b3d3f..70b93af 100644 --- a/frontend/src/components/PollutionMap.jsx +++ b/frontend/src/components/PollutionMap.jsx @@ -39,9 +39,9 @@ const PollutionMapContent = () => { const { config, configLoading, configError } = useConfig(); const { data, dataLoading, dataError } = useDataContext(); - const mapRef = useRef(null); // Referencia al mapa - const voronoiLayerRef = useRef(null); // Referencia al layer de Voronoi - const [showVoronoi, setShowVoronoi] = useState(true); + const mapRef = useRef(null); + const voronoiLayerRef = useRef(null); + const [showVoronoi, setShowVoronoi] = useState(false); useEffect(() => { if (!data || !config) return; @@ -80,6 +80,12 @@ const PollutionMapContent = () => { '© OpenStreetMap contributors' }).addTo(map); + const points = data + .filter(p => isToday(p.timestamp)) + .map(p => [p.lat, p.lon, p.carbonMonoxide]); + + L.heatLayer(points, { radius: 25 }).addTo(map); + fetch("/voronoi_sevilla_geovoronoi.geojson") .then(res => res.json()) .then(geojson => { @@ -105,18 +111,11 @@ const PollutionMapContent = () => { console.error("Error cargando el GeoJSON:", err); }); - const points = data - .filter(p => isToday(p.timestamp)) - .map(p => [p.lat, p.lon, p.carbonMonoxide]); - - L.heatLayer(points, { radius: 25 }).addTo(map); - return () => { map.remove(); }; }, [data, config]); - // Esta parte gestiona el toggle del voronoi const toggleVoronoi = () => { const map = mapRef.current; const voronoiLayer = voronoiLayerRef.current; diff --git a/frontend/vite.config.js b/frontend/vite.config.js index 1807cd4..c5e0b4a 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -5,7 +5,7 @@ import cleanPlugin from 'vite-plugin-clean' // https://vite.dev/config/ export default defineConfig({ server: { - host: "localhost", + host: "0.0.0.0", port: 3000, }, resolve: {