Skip to content

Commit cc947fe

Browse files
committed
fix build deploy
1 parent 0430e38 commit cc947fe

5 files changed

Lines changed: 16 additions & 10 deletions

File tree

frontend/src/components/upme/CapacidadInstaladaCharts.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,11 @@ export function CapacidadInstaladaCharts() {
117117
<XAxis dataKey="year" />
118118
<YAxis label={{ value: 'MW', angle: -90, position: 'insideLeft' }} />
119119
<Tooltip
120-
formatter={(value: number | null) => {
120+
formatter={(value: any) => {
121121
if (value === null || value === undefined) return 'N/A';
122-
return `${value.toLocaleString('es-ES', { maximumFractionDigits: 0 })} MW`;
122+
const numValue = typeof value === 'number' ? value : parseFloat(value);
123+
if (isNaN(numValue)) return 'N/A';
124+
return `${numValue.toLocaleString('es-ES', { maximumFractionDigits: 0 })} MW`;
123125
}}
124126
labelFormatter={(label) => `Año: ${label}`}
125127
/>

frontend/src/components/upme/EnergiaElectricaCharts.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,11 @@ export function EnergiaElectricaCharts() {
118118
<XAxis dataKey="year" />
119119
<YAxis label={{ value: 'GWh-año', angle: -90, position: 'insideLeft' }} />
120120
<Tooltip
121-
formatter={(value: number | null) => {
121+
formatter={(value: any) => {
122122
if (value === null || value === undefined) return 'N/A';
123-
return `${value.toLocaleString('es-ES', { maximumFractionDigits: 0 })} GWh`;
123+
const numValue = typeof value === 'number' ? value : parseFloat(value);
124+
if (isNaN(numValue)) return 'N/A';
125+
return `${numValue.toLocaleString('es-ES', { maximumFractionDigits: 0 })} GWh`;
124126
}}
125127
labelFormatter={(label) => `Año: ${label}`}
126128
/>

frontend/src/components/upme/GasNaturalCharts.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useQuery } from '@tanstack/react-query';
22
import { loadGasNaturalData } from '@/services/upmeData.service';
3-
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer, BarChart, Bar, PieChart, Pie, Cell } from 'recharts';
3+
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer, PieChart, Pie, Cell } from 'recharts';
44
import { useMemo, useState } from 'react';
55

66
const COLORS = ['#3b82f6', '#ef4444', '#10b981', '#f59e0b', '#8b5cf6', '#ec4899', '#06b6d4', '#84cc16', '#f97316', '#6366f1'];
@@ -184,12 +184,12 @@ export function GasNaturalCharts() {
184184
cx="50%"
185185
cy="50%"
186186
labelLine={false}
187-
label={({ name, percent }) => `${name}: ${(percent * 100).toFixed(0)}%`}
187+
label={({ name, percent }) => `${name}: ${((percent ?? 0) * 100).toFixed(0)}%`}
188188
outerRadius={80}
189189
fill="#8884d8"
190190
dataKey="value"
191191
>
192-
{categoriaDistribution.map((entry, index) => (
192+
{categoriaDistribution.map((_, index) => (
193193
<Cell key={`cell-${index}`} fill={COLORS[index % COLORS.length]} />
194194
))}
195195
</Pie>

frontend/src/components/upme/PotenciaMaximaCharts.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,11 @@ export function PotenciaMaximaCharts() {
128128
<XAxis dataKey="year" />
129129
<YAxis label={{ value: 'MW-mes', angle: -90, position: 'insideLeft' }} />
130130
<Tooltip
131-
formatter={(value: number | null) => {
131+
formatter={(value: any) => {
132132
if (value === null || value === undefined) return 'N/A';
133-
return `${value.toLocaleString('es-ES', { maximumFractionDigits: 0 })} MW`;
133+
const numValue = typeof value === 'number' ? value : parseFloat(value);
134+
if (isNaN(numValue)) return 'N/A';
135+
return `${numValue.toLocaleString('es-ES', { maximumFractionDigits: 0 })} MW`;
134136
}}
135137
labelFormatter={(label) => `Año: ${label}`}
136138
/>

frontend/src/services/upmeData.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { EnergiaElectricaRecord, PotenciaMaximaRecord, CapacidadInstaladaRecord, GasNaturalRecord } from '@/types/upme.types';
1+
import type { EnergiaElectricaRecord, PotenciaMaximaRecord, CapacidadInstaladaRecord, GasNaturalRecord } from '@/types/upme.types';
22

33
// Rutas hardcodeadas a los CSVs procesados
44
// Nota: En producción, estos deberían venir de un endpoint API

0 commit comments

Comments
 (0)