Fix RoadmapTab runtime error: pass t parameter to helper functions
Fixed "ReferenceError: t is not defined" error by: - Adding t parameter to calcularPaybackCompleto() function - Adding t parameter to formatearPaybackResult() function - Updating all call sites to pass t from useTranslation() hook Helper functions defined outside React components cannot directly access the t() function from useTranslation() hook. They must receive it as a parameter from the component. https://claude.ai/code/session_01GNbnkFoESkRcnPr3bLCYDg
This commit is contained in:
@@ -187,7 +187,8 @@ const calcularPaybackCompleto = (
|
||||
ahorroAnual: number,
|
||||
waves: string[],
|
||||
esHabilitador: boolean,
|
||||
incluyeQuickWin: boolean
|
||||
incluyeQuickWin: boolean,
|
||||
t: any
|
||||
): PaybackInfo => {
|
||||
// 1. Caso especial: escenario habilitador con poco ahorro directo
|
||||
if (esHabilitador || ahorroAnual < inversion * 0.1) {
|
||||
@@ -230,7 +231,7 @@ const calcularPaybackCompleto = (
|
||||
const paybackTotal = mesesImplementacion + mesesRecuperacion;
|
||||
|
||||
// 7. Formatear resultado según duración
|
||||
return formatearPaybackResult(paybackTotal, mesesImplementacion, mesesRecuperacion, margenMensual, inversion);
|
||||
return formatearPaybackResult(paybackTotal, mesesImplementacion, mesesRecuperacion, margenMensual, inversion, t);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -241,7 +242,8 @@ const formatearPaybackResult = (
|
||||
mesesImpl: number,
|
||||
mesesRec: number,
|
||||
margenMensual: number,
|
||||
inversion: number
|
||||
inversion: number,
|
||||
t: any
|
||||
): PaybackInfo => {
|
||||
const tooltipBase = `Implementación: ${mesesImpl} meses → Recuperación: ${mesesRec} meses. ` +
|
||||
`Margen: ${formatCurrency(margenMensual * 12)}/año.`;
|
||||
@@ -1966,17 +1968,17 @@ export function RoadmapTab({ data }: RoadmapTabProps) {
|
||||
// v3.9: Calcular payback completo para cada escenario
|
||||
const consPaybackInfo = calcularPaybackCompleto(
|
||||
consInversion, consMargen, consSavings,
|
||||
['wave1', 'wave2'], consEsHabilitador, false
|
||||
['wave1', 'wave2'], consEsHabilitador, false, t
|
||||
);
|
||||
const modPaybackInfo = calcularPaybackCompleto(
|
||||
modInversion, modMargen, modSavings,
|
||||
['wave1', 'wave2', 'wave3'], modEsHabilitador, false
|
||||
['wave1', 'wave2', 'wave3'], modEsHabilitador, false, t
|
||||
);
|
||||
// Agresivo incluye Wave 4 (Quick Wins potenciales si hay AUTOMATE queues)
|
||||
const agrIncluyeQuickWin = tierCounts.AUTOMATE.length >= 3;
|
||||
const agrPaybackInfo = calcularPaybackCompleto(
|
||||
agrInversion, agrMargen, agrSavings,
|
||||
['wave1', 'wave2', 'wave3', 'wave4'], agrEsHabilitador, agrIncluyeQuickWin
|
||||
['wave1', 'wave2', 'wave3', 'wave4'], agrEsHabilitador, agrIncluyeQuickWin, t
|
||||
);
|
||||
|
||||
const escenarios: EscenarioData[] = [
|
||||
|
||||
Reference in New Issue
Block a user