// diag-growth.jsx — Curva de crecimiento proyectada en el tiempo (estilo proyección). function GrowthChart({ growth, program, light }) { const W = 680, H = 360; const padL = 54, padR = 74, padT = 92, padB = 46; const { pts, start, goal, milestoneT, milestoneV, milestoneLabel, startLabel, midLabel, endLabel } = growth; const uid = light ? 'pdf' : 'web'; const lineId = 'growthLine_' + uid; const areaId = 'growthArea_' + uid; const lo = Math.max(1, Math.min(start, goal) - 0.5); const hi = Math.min(5, Math.max(start, goal) + 0.45); const span = Math.max(0.5, hi - lo); const xAt = t => padL + t * (W - padL - padR); const yAt = v => padT + (1 - (v - lo) / span) * (H - padT - padB); const linePath = pts.map((p, i) => `${i === 0 ? 'M' : 'L'} ${xAt(p.t).toFixed(1)} ${yAt(p.v).toFixed(1)}`).join(' '); const areaPath = `${linePath} L ${xAt(1).toFixed(1)} ${(H - padB).toFixed(1)} L ${xAt(0).toFixed(1)} ${(H - padB).toFixed(1)} Z`; const mx = xAt(milestoneT), my = yAt(milestoneV); const ex = xAt(1), ey = yAt(goal); const sx = xAt(0), sy = yAt(start); // y gridlines (start, goal) const yTicks = [start, goal].map(v => ({ v, y: yAt(v) })); return ( {/* gridlines + y labels */} {yTicks.map((t, i) => ( {t.v.toFixed(1)} ))} {/* area + line */} {/* milestone */} {(() => { const txt = `${milestoneLabel} · ${milestoneV.toFixed(1)}`; const w = Math.max(150, txt.length * 7.2); return ( {txt} ); })()} {/* start dot */} {/* goal callout */} TU SIGUIENTE NIVEL {goal.toFixed(1)} / 5 {/* x labels */} {startLabel} {midLabel} {endLabel} ); } function GrowthSection({ growth, program, nombre }) { const first = nombre ? nombre.split(' ')[0] : ''; return (
● Tu proyección de crecimiento

{first ? first + ', según' : 'Según'} tus respuestas, puedes pasar de {growth.start.toFixed(1)} a un nivel de {growth.goal.toFixed(1)} / 5 para {growth.endLabel}

Sube +{growth.gain.toFixed(1)} niveles en {growth.weeks} semanas con el {program.title}

*Proyección estimada con avance constante siguiendo la metodología de los 8 ejes.

); } Object.assign(window, { GrowthChart, GrowthSection });