Fix API_BASE_URL
This commit is contained in:
@@ -6,6 +6,7 @@ import { useQuery } from '@tanstack/react-query';
|
||||
import axios from 'axios';
|
||||
import type { Feature, Geometry } from 'geojson';
|
||||
import { geoCentroid } from 'd3-geo';
|
||||
import { API_BASE_URL, assetBaseUrl } from '../apiService';
|
||||
import './MapaBsAs.css';
|
||||
|
||||
// --- Interfaces y Tipos ---
|
||||
@@ -44,7 +45,6 @@ interface PartidoProperties {
|
||||
type PartidoGeography = Feature<Geometry, PartidoProperties> & { rsmKey: string };
|
||||
|
||||
// --- Constantes ---
|
||||
const API_BASE_URL = 'http://localhost:5217/api';
|
||||
const MIN_ZOOM = 1;
|
||||
const MAX_ZOOM = 8;
|
||||
const TRANSLATE_EXTENT: [[number, number], [number, number]] = [[-100, -1000], [1100, 800]];
|
||||
@@ -72,7 +72,7 @@ const MapaBsAs = () => {
|
||||
|
||||
const { data: geoData, isLoading: isLoadingGeo } = useQuery<any>({
|
||||
queryKey: ['mapaGeoData'],
|
||||
queryFn: async () => (await axios.get('/partidos-bsas.topojson')).data,
|
||||
queryFn: async () => (await axios.get(`${assetBaseUrl}/partidos-bsas.topojson`)).data,
|
||||
});
|
||||
|
||||
const { data: agrupacionesData, isLoading: isLoadingAgrupaciones } = useQuery<Agrupacion[]>({
|
||||
@@ -122,7 +122,7 @@ const MapaBsAs = () => {
|
||||
}
|
||||
}, [selectedAmbitoId, handleReset, resultadosPorDepartamento]);
|
||||
|
||||
const handleMoveEnd = (newPosition: { coordinates: PointTuple; zoom: number }) => { // <--- CORRECCIÓN 1
|
||||
const handleMoveEnd = (newPosition: { coordinates: PointTuple; zoom: number }) => {
|
||||
if (newPosition.zoom <= MIN_ZOOM) {
|
||||
if (position.zoom > MIN_ZOOM || selectedAmbitoId !== null) {
|
||||
handleReset();
|
||||
|
||||
@@ -5,8 +5,8 @@ import { Tooltip } from 'react-tooltip';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import axios from 'axios';
|
||||
import { geoCentroid } from 'd3-geo';
|
||||
import { getDetalleSeccion } from '../apiService';
|
||||
import type { ResultadoDetalleSeccion } from '../apiService';
|
||||
import { getDetalleSeccion, API_BASE_URL, assetBaseUrl } from '../apiService';
|
||||
import { type ResultadoDetalleSeccion } from '../apiService';
|
||||
import './MapaBsAs.css';
|
||||
|
||||
// --- Interfaces y Tipos ---
|
||||
@@ -25,7 +25,6 @@ type SeccionGeography = {
|
||||
};
|
||||
|
||||
// --- Constantes ---
|
||||
const API_BASE_URL = 'http://localhost:5217/api';
|
||||
const DEFAULT_MAP_COLOR = '#E0E0E0';
|
||||
const CATEGORIAS: Categoria[] = [{ id: 5, nombre: 'Senadores' }, { id: 6, nombre: 'Diputados' }];
|
||||
const SECCION_ID_TO_ROMAN: Record<string, string> = { '1': 'I', '2': 'II', '3': 'III', '4': 'IV', '5': 'V', '6': 'VI', '7': 'VII', '8': 'VIII' };
|
||||
@@ -102,7 +101,7 @@ const MapaBsAsSecciones = () => {
|
||||
|
||||
const { data: geoData, isLoading: isLoadingGeo } = useQuery<any>({
|
||||
queryKey: ['mapaGeoDataSecciones'],
|
||||
queryFn: async () => (await axios.get('./secciones-electorales-pba.topojson')).data,
|
||||
queryFn: async () => (await axios.get(`${assetBaseUrl}/secciones-electorales-pba.topojson`)).data,
|
||||
});
|
||||
|
||||
const { data: resultadosData, isLoading: isLoadingResultados } = useQuery<ResultadoMapaSeccion[]>({
|
||||
|
||||
@@ -4,6 +4,7 @@ import Select from 'react-select';
|
||||
import { getSeccionesElectorales, getRankingMunicipiosPorSeccion } from '../apiService';
|
||||
import type { MunicipioSimple, ApiResponseRankingMunicipio } from '../types/types';
|
||||
import './ResultadosTablaSeccionWidget.css'; // Reutilizamos el mismo estilo
|
||||
import React from 'react';
|
||||
|
||||
const customSelectStyles = {
|
||||
control: (base: any) => ({ ...base, minWidth: '200px', border: '1px solid #ced4da', boxShadow: 'none', '&:hover': { borderColor: '#86b7fe' } }),
|
||||
@@ -81,16 +82,23 @@ export const ResultadosRankingMunicipioWidget = () => {
|
||||
<th key={`${cat.id}-p2`} colSpan={2} className="puesto-header category-divider-header">2° Puesto</th>
|
||||
])}
|
||||
</tr>
|
||||
{/* --- Fila 3: Partido y % --- */}
|
||||
<tr>
|
||||
<th className="sticky-col"></th> {/* Celda vacía para alinear con Municipio */}
|
||||
{rankingData.categorias.flatMap(cat => [
|
||||
<th key={`${cat.id}-p1-partido`} className="sub-header">Partido</th>,
|
||||
<th key={`${cat.id}-p1-porc`} className="sub-header">%</th>,
|
||||
<th key={`${cat.id}-p2-partido`} className="sub-header category-divider-header">Partido</th>,
|
||||
<th key={`${cat.id}-p2-porc`} className="sub-header">%</th>
|
||||
])}
|
||||
</tr>
|
||||
{/* Fila 3: Sub-cabeceras (Partido, %) */}
|
||||
<tr>
|
||||
{
|
||||
// Usamos un bucle map simple en lugar de flatMap.
|
||||
// React manejará la creación de un array de nodos sin problemas.
|
||||
rankingData.categorias.map(cat => (
|
||||
// Usamos un Fragmento (<>) para agrupar los 4 <th> de cada categoría
|
||||
// sin añadir un nodo extra al DOM.
|
||||
<React.Fragment key={`subheaders-${cat.id}`}>
|
||||
<th className="sub-header">Partido</th>
|
||||
<th className="sub-header">%</th>
|
||||
<th className="sub-header category-divider-header">Partido</th>
|
||||
<th className="sub-header">%</th>
|
||||
</React.Fragment>
|
||||
))
|
||||
}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{rankingData.resultados.map(municipio => (
|
||||
|
||||
@@ -76,7 +76,7 @@ export const ResultadosTablaDetalladaWidget = () => {
|
||||
{tablaData.categorias.flatMap(cat =>
|
||||
(tablaData.partidosPorCategoria[cat.id] || []).map(partido => (
|
||||
<th key={`header-${cat.id}-${partido.id}`} className="partido-header">
|
||||
<span>{partido.puesto}° {partido.nombre}</span>
|
||||
<span>{partido.puesto}° {partido.nombre} - </span>
|
||||
<span className="porcentaje-total">{formatPercent(partido.porcentajeTotalSeccion)}</span>
|
||||
</th>
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user