From fdb387e74cbf7b48dfdae7df95b75c1cb8eeb3a9 Mon Sep 17 00:00:00 2001 From: Mannu Date: Sat, 16 May 2026 15:02:43 +0530 Subject: [PATCH] feat: pass solar DC MW and wind capacity from inputs to generation sheet - Add solarDCMW and windMW props - Pull from inputs_json in scenario page - DC MW column now shows actual capacity from input Co-Authored-By: Claude Opus 4.7 --- packages/web/app/scenarios/[id]/page.tsx | 12 ++++++++++++ packages/web/components/WorkbookView.tsx | 12 +++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/packages/web/app/scenarios/[id]/page.tsx b/packages/web/app/scenarios/[id]/page.tsx index 2787a3a..d95ec8d 100644 --- a/packages/web/app/scenarios/[id]/page.tsx +++ b/packages/web/app/scenarios/[id]/page.tsx @@ -237,6 +237,18 @@ export default function ScenarioPage() { : new Date().getFullYear(); } catch { return new Date().getFullYear(); } })()} + solarDCMW={(() => { + try { + const inputs = scenario?.inputs_json ? JSON.parse(scenario.inputs_json) : {}; + return inputs?.solar?.capacity_dc_mwp || inputs?.project?.capacity_solar_mwp || 0; + } catch { return 0; } + })()} + windMW={(() => { + try { + const inputs = scenario?.inputs_json ? JSON.parse(scenario.inputs_json) : {}; + return inputs?.wind?.capacity_mw || inputs?.project?.capacity_wind_mw || 0; + } catch { return 0; } + })()} /> ) : scenario?.status === "failed" ? (
diff --git a/packages/web/components/WorkbookView.tsx b/packages/web/components/WorkbookView.tsx index ea56a5d..b1bdd91 100644 --- a/packages/web/components/WorkbookView.tsx +++ b/packages/web/components/WorkbookView.tsx @@ -543,7 +543,7 @@ interface HourlyData { hourly_wind_profile?: number[]; } -function HourlyGenerationSheet({ hourly, codYear }: { hourly: HourlyData; codYear?: number }) { +function HourlyGenerationSheet({ hourly, codYear, solarDCMW, windMW }: { hourly: HourlyData; codYear?: number; solarDCMW?: number; windMW?: number }) { const { solar_hourly, wind_hourly, hourly_total_re, hourly_client_end, hourly_load, hourly_solar_profile, hourly_wind_profile } = hourly; const hasSolar = solar_hourly && solar_hourly.length > 0; const hasWind = wind_hourly && wind_hourly.length > 0; @@ -770,11 +770,11 @@ function HourlyGenerationSheet({ hourly, codYear }: { hourly: HourlyData; codYea {fyLabel} {/* Solar 8760: avg profile (show as %), DC MW, Solar MW */} {hasSolar && {(solarProfileAvg * 100).toFixed(1)}%} - {hasSolar && 100} + {hasSolar && {solarDCMW || '-'}} {hasSolar && {Math.round(solarYr).toLocaleString()}} {/* Wind 8760, MW, Wind MW */} {hasWind && -} - {hasWind && 50} + {hasWind && {windMW || '-'}} {hasWind && {Math.round(windYr).toLocaleString()}} {hasTotalRe && {Math.round(totalReYr).toLocaleString()}} {hasClientEnd && {Math.round(clientEndYr).toLocaleString()}} @@ -967,9 +967,11 @@ interface Props { debtScheduleJson: string | null; activeSheet: string; codYear?: number; + solarDCMW?: number; + windMW?: number; } -export function WorkbookView({ scenarioId, kpis, debtScheduleJson, activeSheet, codYear }: Props) { +export function WorkbookView({ scenarioId, kpis, debtScheduleJson, activeSheet, codYear, solarDCMW, windMW }: Props) { const { data: stmts } = useQuery({ queryKey: ["statements", scenarioId], queryFn: () => getStatements(scenarioId), @@ -1025,7 +1027,7 @@ export function WorkbookView({ scenarioId, kpis, debtScheduleJson, activeSheet, hourly_load: stmts?.hourly_load, hourly_solar_profile: stmts?.hourly_solar_profile, hourly_wind_profile: stmts?.hourly_wind_profile, - }} codYear={codYear} /> + }} codYear={codYear} solarDCMW={solarDCMW} windMW={windMW} /> ) : generation.length > 0 ? ( ) : (