Fix API_BASE_URL

This commit is contained in:
2025-09-04 17:19:54 -03:00
parent 2db20969a1
commit 0ce5e2e2c9
11 changed files with 50 additions and 32 deletions

View File

@@ -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 => (