From 30c437475d5b3ab7efe3ee9468df266616d5a441 Mon Sep 17 00:00:00 2001 From: David Trimmer Date: Sat, 7 Nov 2026 18:50:45 -0500 Subject: [PATCH 1/5] Default the calculator to 2027 and add the new scenarios - A coverage year setting, 2027 by default with 2026 selectable, sent to the API and kept in share links (year=). - H.R. 1834 replaces the "IRA Extension" label, and the enhanced credits capped at 700% FPL (a January 2026 draft variant) join the scenarios. The $5 minimum premium variant is built but hidden behind MIN_PREMIUM_AVAILABLE until the API's policyengine-us models it. Each description says the proposal's status. - Each result card shows what the benchmark plan costs after its credit, from the API's benchmark premium at each income. - Current law is labeled with the year, the browser cache key includes the year and a model version, and the page header no longer says 2025 vs 2026. Co-Authored-By: Claude Opus 5.5 (1M context) --- changelog.d/aca-2027-calculator.added.md | 1 + src/App.jsx | 4 +- src/components/Calculator.css | 24 ++++ src/components/Calculator.jsx | 18 ++- src/components/CalculatorForm.jsx | 106 ++++++++++++++- src/components/CalculatorResults.jsx | 157 ++++++++++++++++++++--- src/components/HealthBenefitsChart.jsx | 155 +++++++++++++++++++--- 7 files changed, 423 insertions(+), 42 deletions(-) create mode 100644 changelog.d/aca-2027-calculator.added.md diff --git a/changelog.d/aca-2027-calculator.added.md b/changelog.d/aca-2027-calculator.added.md new file mode 100644 index 0000000..27a4e6d --- /dev/null +++ b/changelog.d/aca-2027-calculator.added.md @@ -0,0 +1 @@ +Default the calculator to 2027 coverage, with 2026 selectable; add the enhanced credits capped at 700% FPL; show the benchmark plan's monthly cost after each scenario's credit; and call the IRA extension H.R. 1834. diff --git a/src/App.jsx b/src/App.jsx index dee304b..2a1f577 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -322,9 +322,9 @@ function App() { {!embedded && (
-

ACA Premium Tax Credits: 2025 vs 2026

+

ACA Premium Tax Credits

- Modeling how the scheduled expiration of IRA enhancements affects health insurance costs + How the expiration of the enhanced credits, and proposals to extend them, affect health insurance costs

@@ -505,7 +601,7 @@ function CalculatorForm({ onCalculate, loading }) { {shareMessage && {shareMessage}}
- {!formData.show_ira && !formData.show_700fpl && !formData.show_additional_bracket && !formData.show_simplified_bracket && ( + {noScenario && (

Please select at least one policy scenario

)} diff --git a/src/components/CalculatorResults.jsx b/src/components/CalculatorResults.jsx index 15358f2..0dd20fe 100644 --- a/src/components/CalculatorResults.jsx +++ b/src/components/CalculatorResults.jsx @@ -12,14 +12,21 @@ function CalculatorResults({ data, formData }) { fpl700: formData?.show_700fpl ?? false, additionalBracket: formData?.show_additional_bracket ?? false, simplifiedBracket: formData?.show_simplified_bracket ?? false, + cap700: formData?.show_700fpl_cap ?? false, + minPremium: formData?.show_min_premium ?? false, }), [formData]); + // An answer from before the API took a year is for 2026. + const year = data?.year || 2026; + const [visibleLines, setVisibleLines] = useState({ baseline: true, ira: true, fpl700: false, additionalBracket: false, simplifiedBracket: false, + cap700: false, + minPremium: false, }); // Sync visibleLines with selectedReforms when formData changes @@ -30,6 +37,8 @@ function CalculatorResults({ data, formData }) { fpl700: selectedReforms.fpl700, additionalBracket: selectedReforms.additionalBracket, simplifiedBracket: selectedReforms.simplifiedBracket, + cap700: selectedReforms.cap700, + minPremium: selectedReforms.minPremium, }); }, [selectedReforms]); @@ -47,9 +56,12 @@ function CalculatorResults({ data, formData }) { ptc_700fpl: data.ptc_700fpl, ptc_additional_bracket: data.ptc_additional_bracket, ptc_simplified_bracket: data.ptc_simplified_bracket, + ptc_700fpl_cap: data.ptc_700fpl_cap, + ptc_min_premium: data.ptc_min_premium, medicaid: data.medicaid, chip: data.chip, fpl: data.fpl, + year: data.year, }; }, [data]); @@ -110,10 +122,15 @@ function CalculatorResults({ data, formData }) { fpl700: 0, additionalBracket: 0, simplifiedBracket: 0, + cap700: 0, + minPremium: 0, iraGain: 0, fpl700Gain: 0, additionalBracketGain: 0, simplifiedBracketGain: 0, + cap700Gain: 0, + minPremiumGain: 0, + benchmark: 0, fplPct: 0, onMedicaid: data.medicaid?.[0] > 0, onChip: data.chip?.[0] > 0, @@ -125,6 +142,14 @@ function CalculatorResults({ data, formData }) { const fpl700 = interpolatePTC(income, data.income, data.ptc_700fpl); const additionalBracket = interpolatePTC(income, data.income, data.ptc_additional_bracket); const simplifiedBracket = interpolatePTC(income, data.income, data.ptc_simplified_bracket); + const cap700 = interpolatePTC(income, data.income, data.ptc_700fpl_cap); + const minPremium = interpolatePTC(income, data.income, data.ptc_min_premium); + // The annual benchmark premium for the members eligible for the credit at + // this income; an answer from before the API reported it by income has + // only the maximum. + const benchmark = data.slcsp_by_income?.length + ? interpolatePTC(income, data.income, data.slcsp_by_income) + : data.slcsp; const fplPct = (income / data.fpl) * 100; return { @@ -138,6 +163,11 @@ function CalculatorResults({ data, formData }) { fpl700Gain: fpl700 - baseline, additionalBracketGain: additionalBracket - baseline, simplifiedBracketGain: simplifiedBracket - baseline, + cap700, + minPremium, + cap700Gain: cap700 - baseline, + minPremiumGain: minPremium - baseline, + benchmark, fplPct, onMedicaid, onChip, @@ -153,9 +183,12 @@ function CalculatorResults({ data, formData }) { }).format(value); }; + // What the benchmark plan costs after a credit, per month. + const netPremium = (credit) => Math.max(0, (userResults?.benchmark || 0) - credit) / 12; + const tabs = [ - { id: "gain", label: "Gain from Reform" }, - { id: "comparison", label: "Baseline vs Extension" }, + { id: "gain", label: "Gain over Current Law" }, + { id: "comparison", label: "Current Law vs Proposals" }, { id: "impact", label: "Your Impact" }, ]; @@ -187,7 +220,29 @@ function CalculatorResults({ data, formData }) { onChange={() => toggleLine('ira')} /> - IRA Extension + H.R. 1834 + + )} + {selectedReforms.cap700 && ( + + )} + {selectedReforms.minPremium && ( + )} {selectedReforms.fpl700 && ( @@ -247,7 +302,7 @@ function CalculatorResults({ data, formData }) { onChange={() => toggleLine('baseline')} /> - Baseline + Current law {selectedReforms.ira && ( + )} + {selectedReforms.cap700 && ( + + )} + {selectedReforms.minPremium && ( + )} {selectedReforms.fpl700 && ( @@ -323,7 +400,11 @@ function CalculatorResults({ data, formData }) {
- {userResults && ( + {userResults && (() => { + // Only members who'd buy a marketplace plan count toward the benchmark, + // so it is zero where everyone has Medicaid or CHIP. + const showNetPremium = userResults.benchmark > 0; + return (

@@ -333,21 +414,57 @@ function CalculatorResults({ data, formData }) {

-

Baseline (2026)

+

Current law ({year})

{formatCurrency(userResults.baseline)}

Annual PTC

{formatCurrency(userResults.baseline / 12)}/month

+ {showNetPremium && ( +

Benchmark plan after credit: {formatCurrency(netPremium(userResults.baseline))}/month

+ )}
{selectedReforms.ira && (
-

IRA Extension

+

H.R. 1834

{formatCurrency(userResults.ira)}

Annual PTC

{formatCurrency(userResults.ira / 12)}/month

{userResults.iraGain > 0 && (

+{formatCurrency(userResults.iraGain)}/year

)} + {showNetPremium && ( +

Benchmark plan after credit: {formatCurrency(netPremium(userResults.ira))}/month

+ )} +
+ )} + + {selectedReforms.cap700 && ( +
+

700% FPL cap (draft)

+

{formatCurrency(userResults.cap700)}

+

Annual PTC

+

{formatCurrency(userResults.cap700 / 12)}/month

+ {userResults.cap700Gain > 0 && ( +

+{formatCurrency(userResults.cap700Gain)}/year

+ )} + {showNetPremium && ( +

Benchmark plan after credit: {formatCurrency(netPremium(userResults.cap700))}/month

+ )} +
+ )} + + {selectedReforms.minPremium && ( +
+

$5 minimum premium (draft)

+

{formatCurrency(userResults.minPremium)}

+

Annual PTC

+

{formatCurrency(userResults.minPremium / 12)}/month

+ {userResults.minPremiumGain > 0 && ( +

+{formatCurrency(userResults.minPremiumGain)}/year

+ )} + {showNetPremium && ( +

Benchmark plan after credit: {formatCurrency(netPremium(userResults.minPremium))}/month

+ )}
)} @@ -360,6 +477,9 @@ function CalculatorResults({ data, formData }) { {userResults.fpl700Gain > 0 && (

+{formatCurrency(userResults.fpl700Gain)}/year

)} + {showNetPremium && ( +

Benchmark plan after credit: {formatCurrency(netPremium(userResults.fpl700))}/month

+ )}
)} @@ -376,6 +496,9 @@ function CalculatorResults({ data, formData }) { {userResults.additionalBracketGain > 0 && (

+{formatCurrency(userResults.additionalBracketGain)}/year

)} + {showNetPremium && ( +

Benchmark plan after credit: {formatCurrency(netPremium(userResults.additionalBracket))}/month

+ )}
)} @@ -392,6 +515,9 @@ function CalculatorResults({ data, formData }) { {userResults.simplifiedBracketGain > 0 && (

+{formatCurrency(userResults.simplifiedBracketGain)}/year

)} + {showNetPremium && ( +

Benchmark plan after credit: {formatCurrency(netPremium(userResults.simplifiedBracket))}/month

+ )}
)} @@ -436,8 +562,8 @@ function CalculatorResults({ data, formData }) {

At {fpl}% FPL, you are above the 700% FPL threshold. {hasIra - ? " The IRA Extension would provide subsidies, but the 700% FPL Bill only extends eligibility to 700% FPL." - : " Your required contribution under the IRA Extension (8.5% of income) exceeds the benchmark premium cost, so you would not receive subsidies under either reform option."} + ? " H.R. 1834 would provide subsidies, but the 700% FPL Bill only extends eligibility to 700% FPL." + : " Your required contribution under H.R. 1834 (8.5% of income) exceeds the benchmark premium cost, so you would not receive subsidies under either reform option."}

); } @@ -448,7 +574,7 @@ function CalculatorResults({ data, formData }) { return (

At {fpl}% FPL, you are above the 400% FPL cliff but within range of both reform options. - Under baseline 2026 law, you would receive no premium tax credits. + Under {year} current law, you would receive no premium tax credits. Both reform options would provide you with subsidies.

); @@ -456,7 +582,7 @@ function CalculatorResults({ data, formData }) { return (

At {fpl}% FPL, you are above the 400% FPL cliff. - The IRA Extension would provide subsidies. The 700% FPL Bill would not provide subsidies because + H.R. 1834 would provide subsidies. The 700% FPL Bill would not provide subsidies because your required contribution (9.25% of income) would exceed the benchmark premium cost.

); @@ -476,7 +602,7 @@ function CalculatorResults({ data, formData }) { return (

At {fpl}% FPL, you are in the marketplace subsidy range. - You would receive subsidies under baseline law, but the reform options + You would receive subsidies under current law, and the reform options would increase your credits by lowering your required contribution percentage.

); @@ -484,7 +610,7 @@ function CalculatorResults({ data, formData }) { return (

At {fpl}% FPL, you are in the marketplace subsidy range. - Your required contribution under baseline law would exceed the benchmark premium cost, + Your required contribution under current law would exceed the benchmark premium cost, so you would not receive subsidies. The reform options lower required contributions and may provide credits.

); @@ -492,7 +618,8 @@ function CalculatorResults({ data, formData }) { })()} - )} + ); + })()} {!userResults && (
diff --git a/src/components/HealthBenefitsChart.jsx b/src/components/HealthBenefitsChart.jsx index ba27069..1037eb2 100644 --- a/src/components/HealthBenefitsChart.jsx +++ b/src/components/HealthBenefitsChart.jsx @@ -22,7 +22,12 @@ const COLORS = { bipartisan: "#7c3aed", additionalBracket: "#059669", // emerald-600 simplifiedBracket: "#d97706", // amber-600 + // Variants of H.R. 1834's schedule, drawn dashed because they follow it over + // most incomes. + cap700: "#1e3a8a", // blue-900 + minPremium: "#e11d48", // rose-600 }; +const VARIANT_DASH = "6 4"; function HealthBenefitsChart({ data, chartState, householdInfo, visibleLines: externalVisibleLines }) { const hasExternalLineControls = @@ -39,6 +44,8 @@ function HealthBenefitsChart({ data, chartState, householdInfo, visibleLines: ex fpl700_focus: ["ptcBaseline", "ptc700FPL"], additional_focus: ["ptcBaseline", "ptcAdditionalBracket"], simplified_focus: ["ptcBaseline", "ptcSimplifiedBracket"], + cap700_focus: ["ptcBaseline", "ptc700FPLCap"], + minprem_focus: ["ptcBaseline", "ptcMinPremium"], both_reforms: ["ptcBaseline", "ptcIRA", "ptc700FPL"], impact: ["deltaIRA", "delta700FPL"], }[chartState] || ["ptcBaseline"]; @@ -77,6 +84,8 @@ function HealthBenefitsChart({ data, chartState, householdInfo, visibleLines: ex ptc700FPL: data.ptc_700fpl?.[i] || 0, ptcAdditionalBracket: data.ptc_additional_bracket?.[i] || 0, ptcSimplifiedBracket: data.ptc_simplified_bracket?.[i] || 0, + ptc700FPLCap: data.ptc_700fpl_cap?.[i] || 0, + ptcMinPremium: data.ptc_min_premium?.[i] || 0, netIncomeBaseline: data.net_income_baseline?.[i] || 0, netIncomeIRA: data.net_income_ira?.[i] || 0, netIncome700FPL: data.net_income_700fpl?.[i] || 0, @@ -94,6 +103,8 @@ function HealthBenefitsChart({ data, chartState, householdInfo, visibleLines: ex case "ptc700FPL": return externalVisibleLines.fpl700 === true; case "ptcAdditionalBracket": return externalVisibleLines.additionalBracket === true; case "ptcSimplifiedBracket": return externalVisibleLines.simplifiedBracket === true; + case "ptc700FPLCap": return externalVisibleLines.cap700 === true; + case "ptcMinPremium": return externalVisibleLines.minPremium === true; case "medicaid": return false; // Not togglable case "chip": return false; // Not togglable default: return false; @@ -117,7 +128,7 @@ function HealthBenefitsChart({ data, chartState, householdInfo, visibleLines: ex }, [data, fpl]); // For impact/focus views, calculate deltas (gains over baseline) - const deltaStates = ["impact", "ira_impact", "gain_view", "fpl700_focus", "additional_focus", "simplified_focus", "both_reforms"]; + const deltaStates = ["impact", "ira_impact", "gain_view", "fpl700_focus", "additional_focus", "simplified_focus", "cap700_focus", "minprem_focus", "both_reforms"]; const impactData = useMemo(() => { if (!deltaStates.includes(chartState)) return chartData; return chartData.map((d) => ({ @@ -129,6 +140,8 @@ function HealthBenefitsChart({ data, chartState, householdInfo, visibleLines: ex deltaIRAOver700FPL: Math.max(0, d.ptcIRA - Math.max(d.ptcBaseline, d.ptc700FPL)), deltaAdditionalBracket: Math.max(0, d.ptcAdditionalBracket - d.ptcBaseline), deltaSimplifiedBracket: Math.max(0, d.ptcSimplifiedBracket - d.ptcBaseline), + delta700FPLCap: Math.max(0, d.ptc700FPLCap - d.ptcBaseline), + deltaMinPremium: Math.max(0, d.ptcMinPremium - d.ptcBaseline), })); }, [chartData, chartState]); @@ -181,23 +194,27 @@ function HealthBenefitsChart({ data, chartState, householdInfo, visibleLines: ex case "chip_focus": return "CHIP coverage by income"; case "ira_reform": - return "Baseline vs IRA extension"; + return "Current law vs H.R. 1834"; case "ira_impact": - return "IRA extension vs current law"; + return "H.R. 1834 vs current law"; case "fpl700_focus": return "700% FPL bill vs current law"; case "additional_focus": return "Additional bracket vs current law"; case "simplified_focus": return "Simplified bracket vs current law"; + case "cap700_focus": + return "Enhanced credits capped at 700% FPL vs current law"; + case "minprem_focus": + return "Enhanced credits with a $5 minimum premium vs current law"; case "gain_view": - return "Gain from reform vs baseline"; + return "Gain over current law"; case "both_reforms": return "Comparing all policy options"; case "all_programs": return "Health coverage programs by income"; default: - return "Annual health benefits by income (2026)"; + return data?.year ? `Annual health benefits by income (${data.year})` : "Annual health benefits by income"; } }; @@ -222,7 +239,9 @@ function HealthBenefitsChart({ data, chartState, householdInfo, visibleLines: ex && chartState !== "both_reforms" && chartState !== "fpl700_focus" && chartState !== "additional_focus" - && chartState !== "simplified_focus"; + && chartState !== "simplified_focus" + && chartState !== "cap700_focus" + && chartState !== "minprem_focus"; return (
@@ -259,7 +278,7 @@ function HealthBenefitsChart({ data, chartState, householdInfo, visibleLines: ex fontSize={12} domain={getYDomain()} ticks={(() => { - const maxY = Math.max(...chartData.map(d => Math.max(d.ptcBaseline || 0, d.ptcIRA || 0, d.ptc700FPL || 0))); + const maxY = Math.max(...chartData.map(d => Math.max(d.ptcBaseline || 0, d.ptcIRA || 0, d.ptc700FPL || 0, d.ptc700FPLCap || 0, d.ptcMinPremium || 0))); const ticks = []; for (let i = 0; i <= maxY + 4000; i += 4000) { ticks.push(i); @@ -267,7 +286,7 @@ function HealthBenefitsChart({ data, chartState, householdInfo, visibleLines: ex return ticks; })()} label={{ - value: (chartState === "impact" || chartState === "gain_view") ? "Gain over baseline" : "Annual value", + value: (chartState === "impact" || chartState === "gain_view") ? "Gain over current law" : "Annual value", angle: -90, position: "insideLeft", offset: 10, @@ -301,7 +320,7 @@ function HealthBenefitsChart({ data, chartState, householdInfo, visibleLines: ex fontWeight: chartState === "cliff_focus" ? 600 : 400, }} /> - {chartState === "both_reforms" && ( + {(chartState === "both_reforms" || chartState === "cap700_focus") && ( )} + {/* 700% FPL CAP FOCUS - baseline + the capped enhanced credits */} + {chartState === "cap700_focus" && ( + + )} + {chartState === "cap700_focus" && ( + + )} + + {/* $5 MINIMUM PREMIUM FOCUS - baseline + the enhanced credits with a minimum */} + {chartState === "minprem_focus" && ( + + )} + {chartState === "minprem_focus" && ( + + )} + {/* GAIN VIEW - lines only showing gains over baseline */} {chartState === "gain_view" && shouldShow("ptcIRA") && ( )} + {chartState === "gain_view" && shouldShow("ptc700FPLCap") && ( + + )} + {chartState === "gain_view" && shouldShow("ptcMinPremium") && ( + + )} {/* COMPARISON VIEW - for "Baseline vs Extension" tab (both_reforms) */} {chartState === "both_reforms" && shouldShow("ptcBaseline") && ( )} + {chartState === "both_reforms" && shouldShow("ptc700FPLCap") && ( + + )} + + {chartState === "both_reforms" && shouldShow("ptcMinPremium") && ( + + )} + {/* AI EXPLANATION MODE - for scrollytelling */} {showDefaultSeries && defaultVisibleLineKeys.includes("ptcBaseline") && ( Date: Sat, 7 Nov 2026 18:58:12 -0500 Subject: [PATCH 2/5] Say so when the server answers for another year Until the backend that takes a year is deployed, the API answers for 2026 whatever the page asks. The results already label the year the answer reports; a notice now says when that isn't the year requested. Co-Authored-By: Claude Opus 5.5 (1M context) --- src/components/Calculator.css | 9 +++++++++ src/components/CalculatorResults.jsx | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/src/components/Calculator.css b/src/components/Calculator.css index fa46908..146437a 100644 --- a/src/components/Calculator.css +++ b/src/components/Calculator.css @@ -564,6 +564,15 @@ margin: 0; } +.results-notice { + margin: 0 0 var(--pe-space-md) 0; + padding: var(--pe-space-sm) var(--pe-space-md); + border-radius: 8px; + background: #fef3c7; + color: #92400e; + font-size: 0.875rem; +} + .impact-net { font-size: 0.8125rem; color: var(--pe-text-secondary); diff --git a/src/components/CalculatorResults.jsx b/src/components/CalculatorResults.jsx index 0dd20fe..1956b4a 100644 --- a/src/components/CalculatorResults.jsx +++ b/src/components/CalculatorResults.jsx @@ -18,6 +18,9 @@ function CalculatorResults({ data, formData }) { // An answer from before the API took a year is for 2026. const year = data?.year || 2026; + // A server that predates the year setting answers for 2026 whatever is asked. + const requestedYear = formData?.year; + const yearMismatch = Boolean(requestedYear) && requestedYear !== year; const [visibleLines, setVisibleLines] = useState({ baseline: true, @@ -194,6 +197,11 @@ function CalculatorResults({ data, formData }) { return (
+ {yearMismatch && ( +

+ These results are for {year}: the calculator's server doesn't support {requestedYear} yet. +

+ )}
{tabs.map(tab => (
)}
@@ -415,11 +410,6 @@ function Calculator() { income: results.income, ptc_baseline: results.ptc_baseline, ptc_ira: results.ptc_ira, - ptc_700fpl: results.ptc_700fpl, - ptc_additional_bracket: results.ptc_additional_bracket, - ptc_simplified_bracket: results.ptc_simplified_bracket, - ptc_700fpl_cap: results.ptc_700fpl_cap, - ptc_min_premium: results.ptc_min_premium, medicaid: results.medicaid, chip: results.chip, fpl: results.fpl, diff --git a/src/components/CalculatorForm.jsx b/src/components/CalculatorForm.jsx index 03bdbca..dfb0a6a 100644 --- a/src/components/CalculatorForm.jsx +++ b/src/components/CalculatorForm.jsx @@ -10,19 +10,9 @@ const STATES = [ "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY", "DC", ]; -// Coverage years the calculator models; the first is the default. -export const YEARS = [2027, 2026]; -const DEFAULT_YEAR = YEARS[0]; - -// The $5 minimum premium scenario needs a policyengine-us release with -// gov.contrib.aca.minimum_premium (policyengine-us #10681) in the API's image; -// the API pins 2.115.0, which has it. -export const MIN_PREMIUM_AVAILABLE = true; - -const parseYear = (value) => { - const year = parseInt(value, 10); - return YEARS.includes(year) ? year : DEFAULT_YEAR; -}; +// Every calculation is for 2027 coverage under current law and under H.R. +// 1834, with 2026 current law alongside. +export const YEAR = 2027; const STATE_NAMES = { AL: "Alabama", AK: "Alaska", AZ: "Arizona", AR: "Arkansas", CA: "California", @@ -54,7 +44,6 @@ const buildShareableUrl = (formData, includeAi = false) => { const ageSpouse = formData.age_spouse === "" ? 40 : formData.age_spouse; const depAges = formData.dependent_ages.map(age => age === "" ? 10 : age); - params.set("year", formData.year); params.set("age", ageHead); if (formData.married) { params.set("spouse", ageSpouse); @@ -67,12 +56,6 @@ const buildShareableUrl = (formData, includeAi = false) => { if (formData.zip_code) { params.set("zip", formData.zip_code); } - if (!formData.show_ira) params.set("ira", "0"); - if (!formData.show_700fpl) params.set("700fpl", "0"); - if (formData.show_additional_bracket) params.set("additional", "1"); - if (formData.show_simplified_bracket) params.set("simplified", "1"); - if (formData.show_700fpl_cap) params.set("cap700", "1"); - if (formData.show_min_premium) params.set("minprem", "1"); if (includeAi) params.set("ai", "1"); const baseUrl = window.location.origin + window.location.pathname; @@ -98,8 +81,9 @@ const getFormDataFromUrl = () => { const depsStr = params.get("deps"); const dependentAges = depsStr ? depsStr.split(",").map(a => parseInt(a, 10)).filter(a => !isNaN(a)) : []; + // Links from before the calculator compared fixed scenarios also carry a + // year and scenario choices; only the household is read. return { - year: parseYear(params.get("year")), age_head: parseInt(params.get("age"), 10) || 40, age_spouse: parseInt(params.get("spouse"), 10) || 40, married: params.has("spouse"), @@ -108,12 +92,6 @@ const getFormDataFromUrl = () => { state: STATES.includes(state) ? state : "", county: county, zip_code: params.get("zip") || "", - show_ira: params.get("ira") !== "0", - show_700fpl: params.get("700fpl") !== "0", - show_additional_bracket: params.get("additional") === "1", - show_simplified_bracket: params.get("simplified") === "1", - show_700fpl_cap: params.get("cap700") === "1", - show_min_premium: MIN_PREMIUM_AVAILABLE && params.get("minprem") === "1", }; }; @@ -135,7 +113,6 @@ const getInitialFormData = () => { } const defaults = getRandomDefaults(); return { - year: DEFAULT_YEAR, age_head: defaults.age, age_spouse: defaults.age, married: false, @@ -144,12 +121,6 @@ const getInitialFormData = () => { state: defaults.state, county: defaults.county, zip_code: "", - show_ira: true, - show_700fpl: true, - show_additional_bracket: false, - show_simplified_bracket: false, - show_700fpl_cap: false, - show_min_premium: false, }; }; @@ -247,19 +218,15 @@ function CalculatorForm({ onCalculate, loading }) { const depAges = formData.dependent_ages.slice(0, numDeps).map(age => age === "" ? 10 : age); const submitData = { - year: formData.year, + year: YEAR, age_head: ageHead, age_spouse: formData.married ? ageSpouse : null, dependent_ages: depAges, state: formData.state, county: formData.county, zip_code: formData.zip_code || null, - show_ira: formData.show_ira, - show_700fpl: formData.show_700fpl, - show_additional_bracket: formData.show_additional_bracket, - show_simplified_bracket: formData.show_simplified_bracket, - show_700fpl_cap: formData.show_700fpl_cap, - show_min_premium: formData.show_min_premium, + show_ira: true, + show_prior_year: true, }; // Update form with normalized values @@ -277,35 +244,9 @@ function CalculatorForm({ onCalculate, loading }) { }; const needsZipCode = formData.state === "CA" && formData.county === "Los Angeles County"; - const noScenario = !formData.show_ira && !formData.show_700fpl && !formData.show_additional_bracket - && !formData.show_simplified_bracket && !formData.show_700fpl_cap && !formData.show_min_premium; return (
- {/* Coverage year */} -
-

Coverage Year

-
-
- - - - Credits for {formData.year} measure income against the {formData.year - 1} poverty guidelines - -
-
-
- {/* Household Composition */}

Household Composition

@@ -460,128 +401,11 @@ function CalculatorForm({ onCalculate, loading }) { )}
- {/* Policy Scenarios */} -
-

Policy Scenarios

- -
- -
- -
- -
- - {MIN_PREMIUM_AVAILABLE && ( -
- -
- )} - -
- -
- -
- -
- -
- -
-
-
@@ -600,10 +424,6 @@ function CalculatorForm({ onCalculate, loading }) { {shareMessage && {shareMessage}}
- - {noScenario && ( -

Please select at least one policy scenario

- )}
); } diff --git a/src/components/CalculatorResults.jsx b/src/components/CalculatorResults.jsx index 1956b4a..9e19c96 100644 --- a/src/components/CalculatorResults.jsx +++ b/src/components/CalculatorResults.jsx @@ -1,200 +1,175 @@ -import { useState, useMemo, useEffect } from "react"; -import HealthBenefitsChart from "./HealthBenefitsChart"; +import { useState, useMemo } from "react"; +import PremiumChart from "./PremiumChart"; import "./Calculator.css"; +const TABS = [ + { id: "net", label: "What You'd Pay" }, + { id: "credit", label: "Premium Tax Credits" }, + { id: "impact", label: "Your Household" }, +]; + +const formatCurrency = (value) => + new Intl.NumberFormat("en-US", { + style: "currency", + currency: "USD", + maximumFractionDigits: 0, + }).format(value); + +// A monthly change in what the household pays, such as "+$12/month". +const formatChange = (monthly) => { + const rounded = Math.round(monthly); + if (rounded === 0) return "No change"; + return `${rounded > 0 ? "+" : "−"}${formatCurrency(Math.abs(rounded))}/month`; +}; + +// Linear interpolation of an array along the income axis. +const interpolate = (income, incomeArray, values) => { + if (!incomeArray || !values || income <= 0) return 0; + let i = 0; + while (i < incomeArray.length - 1 && incomeArray[i + 1] < income) { + i++; + } + if (i >= incomeArray.length - 1) { + return values[values.length - 1]; + } + const x0 = incomeArray[i]; + const x1 = incomeArray[i + 1]; + if (x1 === x0) return values[i]; + return values[i] + ((values[i + 1] - values[i]) * (income - x0)) / (x1 - x0); +}; + +const closestIndex = (income, incomeArray) => { + let closest = 0; + for (let i = 0; i < incomeArray.length; i++) { + if (Math.abs(incomeArray[i] - income) < Math.abs(incomeArray[closest] - income)) { + closest = i; + } + } + return closest; +}; + function CalculatorResults({ data, formData }) { - const [activeTab, setActiveTab] = useState("gain"); + const [activeTab, setActiveTab] = useState("net"); const [userIncome, setUserIncome] = useState(""); - // Determine which reforms were actually calculated - const selectedReforms = useMemo(() => ({ - ira: formData?.show_ira ?? true, - fpl700: formData?.show_700fpl ?? false, - additionalBracket: formData?.show_additional_bracket ?? false, - simplifiedBracket: formData?.show_simplified_bracket ?? false, - cap700: formData?.show_700fpl_cap ?? false, - minPremium: formData?.show_min_premium ?? false, - }), [formData]); - // An answer from before the API took a year is for 2026. const year = data?.year || 2026; // A server that predates the year setting answers for 2026 whatever is asked. const requestedYear = formData?.year; const yearMismatch = Boolean(requestedYear) && requestedYear !== year; + const hasPrior = Boolean(data?.ptc_prior_year?.length); - const [visibleLines, setVisibleLines] = useState({ - baseline: true, - ira: true, - fpl700: false, - additionalBracket: false, - simplifiedBracket: false, - cap700: false, - minPremium: false, - }); - - // Sync visibleLines with selectedReforms when formData changes - useEffect(() => { - setVisibleLines({ - baseline: true, - ira: selectedReforms.ira, - fpl700: selectedReforms.fpl700, - additionalBracket: selectedReforms.additionalBracket, - simplifiedBracket: selectedReforms.simplifiedBracket, - cap700: selectedReforms.cap700, - minPremium: selectedReforms.minPremium, + // Annual amounts at the income entered, for each scenario. + const userResults = useMemo(() => { + const income = parseFloat(userIncome) || 0; + if (!data || income <= 0) return null; + const at = (values) => interpolate(income, data.income, values); + const scenario = (benchmark, credit) => ({ + benchmark, + credit, + net: Math.max(0, benchmark - credit), }); - }, [selectedReforms]); - - const toggleLine = (line) => { - setVisibleLines(prev => ({ ...prev, [line]: !prev[line] })); - }; - - // Format data for HealthBenefitsChart - const chartData = useMemo(() => { - if (!data) return null; + const index = closestIndex(income, data.income); return { - income: data.income, - ptc_baseline: data.ptc_baseline, - ptc_ira: data.ptc_ira, - ptc_700fpl: data.ptc_700fpl, - ptc_additional_bracket: data.ptc_additional_bracket, - ptc_simplified_bracket: data.ptc_simplified_bracket, - ptc_700fpl_cap: data.ptc_700fpl_cap, - ptc_min_premium: data.ptc_min_premium, - medicaid: data.medicaid, - chip: data.chip, - fpl: data.fpl, - year: data.year, + income, + fplPct: (income / data.fpl) * 100, + onMedicaid: data.medicaid?.[index] > 0, + onChip: data.chip?.[index] > 0, + prior: hasPrior ? scenario(at(data.slcsp_by_income_prior_year), at(data.ptc_prior_year)) : null, + current: scenario(at(data.slcsp_by_income), at(data.ptc_baseline)), + revived: scenario(at(data.slcsp_by_income), at(data.ptc_ira)), }; - }, [data]); - - // Interpolate PTC value at user's income - const interpolatePTC = (income, incomeArray, ptcArray) => { - if (!incomeArray || !ptcArray || income <= 0) return 0; - - // Find surrounding points - let i = 0; - while (i < incomeArray.length - 1 && incomeArray[i + 1] < income) { - i++; + }, [userIncome, data, hasPrior]); + + const cards = userResults + ? [ + userResults.prior && { + key: "prior", + title: `${year - 1}, current law`, + values: userResults.prior, + }, + { + key: "baseline", + title: `${year}, current law`, + values: userResults.current, + change: userResults.prior && { + monthly: (userResults.current.net - userResults.prior.net) / 12, + from: `from ${year - 1}`, + }, + }, + { + key: "ira", + title: `${year}, H.R. 1834`, + values: userResults.revived, + change: { + monthly: (userResults.revived.net - userResults.current.net) / 12, + from: "from current law", + }, + }, + ].filter(Boolean) + : []; + + const explanation = () => { + const { fplPct, onMedicaid, onChip, prior, current, revived } = userResults; + const fpl = fplPct.toFixed(0); + const monthly = (annual) => `${formatCurrency(annual / 12)}/month`; + + if (onMedicaid || onChip) { + const programs = [onMedicaid && "Medicaid", onChip && "CHIP"].filter(Boolean).join(" and "); + return ( +

+ At {fpl}% FPL, your household would be covered by {programs}. + Premium tax credits are not available to people eligible for these programs. +

+ ); } - if (i >= incomeArray.length - 1) { - return ptcArray[ptcArray.length - 1]; + if (fplPct < 100 && current.credit <= 0 && revived.credit <= 0) { + return ( +

+ At {fpl}% FPL, you fall into the coverage gap. Your state has not + expanded Medicaid, so adults at this income don't qualify, and premium tax credits + start at 100% FPL. +

+ ); } - // Linear interpolation - const x0 = incomeArray[i]; - const x1 = incomeArray[i + 1]; - const y0 = ptcArray[i]; - const y1 = ptcArray[i + 1]; - - if (x1 === x0) return y0; - return y0 + (y1 - y0) * (income - x0) / (x1 - x0); - }; - - // Calculate values at user's income - const userResults = useMemo(() => { - const income = parseFloat(userIncome) || 0; - if (!data) return null; - - // Find closest index for medicaid/chip lookup - const findClosestIndex = (targetIncome, incomeArray) => { - if (!incomeArray || targetIncome <= 0) return 0; - let closest = 0; - let minDiff = Infinity; - for (let i = 0; i < incomeArray.length; i++) { - const diff = Math.abs(incomeArray[i] - targetIncome); - if (diff < minDiff) { - minDiff = diff; - closest = i; - } - } - return closest; - }; - - const closestIdx = findClosestIndex(income, data.income); - const onMedicaid = data.medicaid?.[closestIdx] > 0; - const onChip = data.chip?.[closestIdx] > 0; - - // At 0 income, check actual medicaid status - if (income <= 0) { - return { - income: 0, - baseline: 0, - ira: 0, - fpl700: 0, - additionalBracket: 0, - simplifiedBracket: 0, - cap700: 0, - minPremium: 0, - iraGain: 0, - fpl700Gain: 0, - additionalBracketGain: 0, - simplifiedBracketGain: 0, - cap700Gain: 0, - minPremiumGain: 0, - benchmark: 0, - fplPct: 0, - onMedicaid: data.medicaid?.[0] > 0, - onChip: data.chip?.[0] > 0, - }; + if (current.credit <= 0 && fplPct > 400) { + return ( +

+ At {fpl}% FPL, your household is above current law's 400% FPL limit, so + it gets no credit and pays the whole benchmark premium: {monthly(current.benchmark)} in {year} + {prior && <>, against {monthly(prior.benchmark)} in {year - 1}}.{" "} + {revived.credit > 0 + ? `H.R. 1834 would limit what it pays for the benchmark plan to 8.5% of income, a credit of ${monthly(revived.credit)}.` + : "Under H.R. 1834 it would get no credit either: the benchmark plan costs less than 8.5% of its income."} +

+ ); } - const baseline = interpolatePTC(income, data.income, data.ptc_baseline); - const ira = interpolatePTC(income, data.income, data.ptc_ira); - const fpl700 = interpolatePTC(income, data.income, data.ptc_700fpl); - const additionalBracket = interpolatePTC(income, data.income, data.ptc_additional_bracket); - const simplifiedBracket = interpolatePTC(income, data.income, data.ptc_simplified_bracket); - const cap700 = interpolatePTC(income, data.income, data.ptc_700fpl_cap); - const minPremium = interpolatePTC(income, data.income, data.ptc_min_premium); - // The annual benchmark premium for the members eligible for the credit at - // this income; an answer from before the API reported it by income has - // only the maximum. - const benchmark = data.slcsp_by_income?.length - ? interpolatePTC(income, data.income, data.slcsp_by_income) - : data.slcsp; - const fplPct = (income / data.fpl) * 100; - - return { - income, - baseline, - ira, - fpl700, - additionalBracket, - simplifiedBracket, - iraGain: ira - baseline, - fpl700Gain: fpl700 - baseline, - additionalBracketGain: additionalBracket - baseline, - simplifiedBracketGain: simplifiedBracket - baseline, - cap700, - minPremium, - cap700Gain: cap700 - baseline, - minPremiumGain: minPremium - baseline, - benchmark, - fplPct, - onMedicaid, - onChip, - }; - }, [userIncome, data]); + if (current.credit > 0) { + return ( +

+ At {fpl}% FPL, current law limits what your household pays for the benchmark plan to a + share of its income, and the credit pays the rest, so the credit grows when premiums do. + Your household would pay {monthly(current.net)} in {year} + {prior && <>, against {monthly(prior.net)} in {year - 1}}. H.R. 1834 would lower its + share of income, to {monthly(revived.net)}. +

+ ); + } - // Format currency - const formatCurrency = (value) => { - return new Intl.NumberFormat("en-US", { - style: "currency", - currency: "USD", - maximumFractionDigits: 0, - }).format(value); + return ( +

+ At {fpl}% FPL, the benchmark plan costs less than the share of income current law asks your + household to pay, so it gets no credit.{" "} + {revived.credit > 0 + ? `H.R. 1834 would lower that share, giving a credit of ${monthly(revived.credit)}.` + : "H.R. 1834 wouldn't give it a credit either."} +

+ ); }; - // What the benchmark plan costs after a credit, per month. - const netPremium = (credit) => Math.max(0, (userResults?.benchmark || 0) - credit) / 12; - - const tabs = [ - { id: "gain", label: "Gain over Current Law" }, - { id: "comparison", label: "Current Law vs Proposals" }, - { id: "impact", label: "Your Impact" }, - ]; - return (
{yearMismatch && ( @@ -203,7 +178,7 @@ function CalculatorResults({ data, formData }) {

)}
- {tabs.map(tab => ( + {TABS.map((tab) => (
- {userResults && (() => { - // Only members who'd buy a marketplace plan count toward the benchmark, - // so it is zero where everyone has Medicaid or CHIP. - const showNetPremium = userResults.benchmark > 0; - return ( + {userResults && (

- {formatCurrency(userResults.income)} is approximately {userResults.fplPct.toFixed(0)}% FPL for your household + {formatCurrency(userResults.income)} is approximately{" "} + {userResults.fplPct.toFixed(0)}% FPL for your household

-
-

Current law ({year})

-

{formatCurrency(userResults.baseline)}

-

Annual PTC

-

{formatCurrency(userResults.baseline / 12)}/month

- {showNetPremium && ( -

Benchmark plan after credit: {formatCurrency(netPremium(userResults.baseline))}/month

- )} -
- - {selectedReforms.ira && ( -
-

H.R. 1834

-

{formatCurrency(userResults.ira)}

-

Annual PTC

-

{formatCurrency(userResults.ira / 12)}/month

- {userResults.iraGain > 0 && ( -

+{formatCurrency(userResults.iraGain)}/year

- )} - {showNetPremium && ( -

Benchmark plan after credit: {formatCurrency(netPremium(userResults.ira))}/month

- )} -
- )} - - {selectedReforms.cap700 && ( -
-

700% FPL cap (draft)

-

{formatCurrency(userResults.cap700)}

-

Annual PTC

-

{formatCurrency(userResults.cap700 / 12)}/month

- {userResults.cap700Gain > 0 && ( -

+{formatCurrency(userResults.cap700Gain)}/year

- )} - {showNetPremium && ( -

Benchmark plan after credit: {formatCurrency(netPremium(userResults.cap700))}/month

- )} -
- )} - - {selectedReforms.minPremium && ( -
-

$5 minimum premium (draft)

-

{formatCurrency(userResults.minPremium)}

-

Annual PTC

-

{formatCurrency(userResults.minPremium / 12)}/month

- {userResults.minPremiumGain > 0 && ( -

+{formatCurrency(userResults.minPremiumGain)}/year

- )} - {showNetPremium && ( -

Benchmark plan after credit: {formatCurrency(netPremium(userResults.minPremium))}/month

- )} -
- )} - - {selectedReforms.fpl700 && ( -
-

700% FPL Bill

-

{formatCurrency(userResults.fpl700)}

-

Annual PTC

-

{formatCurrency(userResults.fpl700 / 12)}/month

- {userResults.fpl700Gain > 0 && ( -

+{formatCurrency(userResults.fpl700Gain)}/year

- )} - {showNetPremium && ( -

Benchmark plan after credit: {formatCurrency(netPremium(userResults.fpl700))}/month

- )} -
- )} - - {selectedReforms.additionalBracket && ( -
-

- - Additional Bracket - -

-

{formatCurrency(userResults.additionalBracket)}

-

Annual PTC

-

{formatCurrency(userResults.additionalBracket / 12)}/month

- {userResults.additionalBracketGain > 0 && ( -

+{formatCurrency(userResults.additionalBracketGain)}/year

- )} - {showNetPremium && ( -

Benchmark plan after credit: {formatCurrency(netPremium(userResults.additionalBracket))}/month

- )} -
- )} - - {selectedReforms.simplifiedBracket && ( -
-

- - Simplified Bracket - -

-

{formatCurrency(userResults.simplifiedBracket)}

-

Annual PTC

-

{formatCurrency(userResults.simplifiedBracket / 12)}/month

- {userResults.simplifiedBracketGain > 0 && ( -

+{formatCurrency(userResults.simplifiedBracketGain)}/year

- )} - {showNetPremium && ( -

Benchmark plan after credit: {formatCurrency(netPremium(userResults.simplifiedBracket))}/month

+ {cards.map((card) => ( +
+

{card.title}

+

{formatCurrency(card.values.net / 12)}

+

Benchmark plan after credit, per month

+
+
+
Benchmark plan
+
{formatCurrency(card.values.benchmark / 12)}
+
+
+
Premium tax credit
+
{formatCurrency(card.values.credit / 12)}
+
+
+ {card.change && ( +

+ {formatChange(card.change.monthly)} {card.change.from} +

)}
- )} + ))}

What this means

- {(() => { - const hasBaseline = userResults.baseline > 0; - const hasIra = userResults.ira > 0; - const hasFpl700 = userResults.fpl700 > 0; - const fpl = userResults.fplPct.toFixed(0); - - // Check if on Medicaid or CHIP based on actual calculations - if (userResults.onMedicaid || userResults.onChip) { - const programs = []; - if (userResults.onMedicaid) programs.push("Medicaid"); - if (userResults.onChip) programs.push("CHIP"); - const programList = programs.join(" and "); - return ( -

- At {fpl}% FPL, your household would be covered by {programList}. - Premium tax credits are not available when eligible for these programs. -

- ); - } - - // Below 100% FPL with no Medicaid - coverage gap - if (userResults.fplPct < 100 && !hasBaseline && !hasIra && !hasFpl700) { - return ( -

- At {fpl}% FPL, you fall into the coverage gap. - Your state has not expanded Medicaid, so adults at this income level don't qualify. - Marketplace subsidies are only available starting at 100% FPL, - leaving a gap in coverage for those below 100% FPL in non-expansion states. -

- ); - } - - // Above 700% FPL - only IRA could help - if (userResults.fplPct > 700) { - return ( -

- At {fpl}% FPL, you are above the 700% FPL threshold. - {hasIra - ? " H.R. 1834 would provide subsidies, but the 700% FPL Bill only extends eligibility to 700% FPL." - : " Your required contribution under H.R. 1834 (8.5% of income) exceeds the benchmark premium cost, so you would not receive subsidies under either reform option."} -

- ); - } - - // Above 400% FPL but under 700% - if (userResults.fplPct > 400) { - if (hasIra && hasFpl700) { - return ( -

- At {fpl}% FPL, you are above the 400% FPL cliff but within range of both reform options. - Under {year} current law, you would receive no premium tax credits. - Both reform options would provide you with subsidies. -

- ); - } else if (hasIra && !hasFpl700) { - return ( -

- At {fpl}% FPL, you are above the 400% FPL cliff. - H.R. 1834 would provide subsidies. The 700% FPL Bill would not provide subsidies because - your required contribution (9.25% of income) would exceed the benchmark premium cost. -

- ); - } else { - return ( -

- At {fpl}% FPL, you are above the 400% FPL cliff. - Your income is high enough that your required contribution would exceed the benchmark premium cost, - so neither reform option would provide subsidies at this income level. -

- ); - } - } - - // Between 138% and 400% FPL - if (hasBaseline) { - return ( -

- At {fpl}% FPL, you are in the marketplace subsidy range. - You would receive subsidies under current law, and the reform options - would increase your credits by lowering your required contribution percentage. -

- ); - } else { - return ( -

- At {fpl}% FPL, you are in the marketplace subsidy range. - Your required contribution under current law would exceed the benchmark premium cost, - so you would not receive subsidies. The reform options lower required contributions and may provide credits. -

- ); - } - })()} + {explanation()}
- ); - })()} + )} {!userResults && (
-

Enter your income above to see how each policy would affect your premium tax credits.

+

+ Enter your income above to see what your household would pay for the benchmark + plan in each scenario. +

)}
diff --git a/src/components/HealthBenefitsChart.jsx b/src/components/HealthBenefitsChart.jsx index 1037eb2..85ceb2b 100644 --- a/src/components/HealthBenefitsChart.jsx +++ b/src/components/HealthBenefitsChart.jsx @@ -22,12 +22,7 @@ const COLORS = { bipartisan: "#7c3aed", additionalBracket: "#059669", // emerald-600 simplifiedBracket: "#d97706", // amber-600 - // Variants of H.R. 1834's schedule, drawn dashed because they follow it over - // most incomes. - cap700: "#1e3a8a", // blue-900 - minPremium: "#e11d48", // rose-600 }; -const VARIANT_DASH = "6 4"; function HealthBenefitsChart({ data, chartState, householdInfo, visibleLines: externalVisibleLines }) { const hasExternalLineControls = @@ -44,8 +39,6 @@ function HealthBenefitsChart({ data, chartState, householdInfo, visibleLines: ex fpl700_focus: ["ptcBaseline", "ptc700FPL"], additional_focus: ["ptcBaseline", "ptcAdditionalBracket"], simplified_focus: ["ptcBaseline", "ptcSimplifiedBracket"], - cap700_focus: ["ptcBaseline", "ptc700FPLCap"], - minprem_focus: ["ptcBaseline", "ptcMinPremium"], both_reforms: ["ptcBaseline", "ptcIRA", "ptc700FPL"], impact: ["deltaIRA", "delta700FPL"], }[chartState] || ["ptcBaseline"]; @@ -84,8 +77,6 @@ function HealthBenefitsChart({ data, chartState, householdInfo, visibleLines: ex ptc700FPL: data.ptc_700fpl?.[i] || 0, ptcAdditionalBracket: data.ptc_additional_bracket?.[i] || 0, ptcSimplifiedBracket: data.ptc_simplified_bracket?.[i] || 0, - ptc700FPLCap: data.ptc_700fpl_cap?.[i] || 0, - ptcMinPremium: data.ptc_min_premium?.[i] || 0, netIncomeBaseline: data.net_income_baseline?.[i] || 0, netIncomeIRA: data.net_income_ira?.[i] || 0, netIncome700FPL: data.net_income_700fpl?.[i] || 0, @@ -103,8 +94,6 @@ function HealthBenefitsChart({ data, chartState, householdInfo, visibleLines: ex case "ptc700FPL": return externalVisibleLines.fpl700 === true; case "ptcAdditionalBracket": return externalVisibleLines.additionalBracket === true; case "ptcSimplifiedBracket": return externalVisibleLines.simplifiedBracket === true; - case "ptc700FPLCap": return externalVisibleLines.cap700 === true; - case "ptcMinPremium": return externalVisibleLines.minPremium === true; case "medicaid": return false; // Not togglable case "chip": return false; // Not togglable default: return false; @@ -128,7 +117,7 @@ function HealthBenefitsChart({ data, chartState, householdInfo, visibleLines: ex }, [data, fpl]); // For impact/focus views, calculate deltas (gains over baseline) - const deltaStates = ["impact", "ira_impact", "gain_view", "fpl700_focus", "additional_focus", "simplified_focus", "cap700_focus", "minprem_focus", "both_reforms"]; + const deltaStates = ["impact", "ira_impact", "gain_view", "fpl700_focus", "additional_focus", "simplified_focus", "both_reforms"]; const impactData = useMemo(() => { if (!deltaStates.includes(chartState)) return chartData; return chartData.map((d) => ({ @@ -140,8 +129,6 @@ function HealthBenefitsChart({ data, chartState, householdInfo, visibleLines: ex deltaIRAOver700FPL: Math.max(0, d.ptcIRA - Math.max(d.ptcBaseline, d.ptc700FPL)), deltaAdditionalBracket: Math.max(0, d.ptcAdditionalBracket - d.ptcBaseline), deltaSimplifiedBracket: Math.max(0, d.ptcSimplifiedBracket - d.ptcBaseline), - delta700FPLCap: Math.max(0, d.ptc700FPLCap - d.ptcBaseline), - deltaMinPremium: Math.max(0, d.ptcMinPremium - d.ptcBaseline), })); }, [chartData, chartState]); @@ -203,10 +190,6 @@ function HealthBenefitsChart({ data, chartState, householdInfo, visibleLines: ex return "Additional bracket vs current law"; case "simplified_focus": return "Simplified bracket vs current law"; - case "cap700_focus": - return "Enhanced credits capped at 700% FPL vs current law"; - case "minprem_focus": - return "Enhanced credits with a $5 minimum premium vs current law"; case "gain_view": return "Gain over current law"; case "both_reforms": @@ -239,9 +222,7 @@ function HealthBenefitsChart({ data, chartState, householdInfo, visibleLines: ex && chartState !== "both_reforms" && chartState !== "fpl700_focus" && chartState !== "additional_focus" - && chartState !== "simplified_focus" - && chartState !== "cap700_focus" - && chartState !== "minprem_focus"; + && chartState !== "simplified_focus"; return (
@@ -278,7 +259,7 @@ function HealthBenefitsChart({ data, chartState, householdInfo, visibleLines: ex fontSize={12} domain={getYDomain()} ticks={(() => { - const maxY = Math.max(...chartData.map(d => Math.max(d.ptcBaseline || 0, d.ptcIRA || 0, d.ptc700FPL || 0, d.ptc700FPLCap || 0, d.ptcMinPremium || 0))); + const maxY = Math.max(...chartData.map(d => Math.max(d.ptcBaseline || 0, d.ptcIRA || 0, d.ptc700FPL || 0))); const ticks = []; for (let i = 0; i <= maxY + 4000; i += 4000) { ticks.push(i); @@ -320,7 +301,7 @@ function HealthBenefitsChart({ data, chartState, householdInfo, visibleLines: ex fontWeight: chartState === "cliff_focus" ? 600 : 400, }} /> - {(chartState === "both_reforms" || chartState === "cap700_focus") && ( + {chartState === "both_reforms" && ( )} - {/* 700% FPL CAP FOCUS - baseline + the capped enhanced credits */} - {chartState === "cap700_focus" && ( - - )} - {chartState === "cap700_focus" && ( - - )} - - {/* $5 MINIMUM PREMIUM FOCUS - baseline + the enhanced credits with a minimum */} - {chartState === "minprem_focus" && ( - - )} - {chartState === "minprem_focus" && ( - - )} - {/* GAIN VIEW - lines only showing gains over baseline */} {chartState === "gain_view" && shouldShow("ptcIRA") && ( )} - {chartState === "gain_view" && shouldShow("ptc700FPLCap") && ( - - )} - {chartState === "gain_view" && shouldShow("ptcMinPremium") && ( - - )} {/* COMPARISON VIEW - for "Baseline vs Extension" tab (both_reforms) */} {chartState === "both_reforms" && shouldShow("ptcBaseline") && ( )} - {chartState === "both_reforms" && shouldShow("ptc700FPLCap") && ( - - )} - - {chartState === "both_reforms" && shouldShow("ptcMinPremium") && ( - - )} - {/* AI EXPLANATION MODE - for scrollytelling */} {showDefaultSeries && defaultVisibleLineKeys.includes("ptcBaseline") && ( + new Intl.NumberFormat("en-US", { + style: "currency", + currency: "USD", + maximumFractionDigits: 0, + }).format(value); + +// What the benchmark plan costs after the credit, never below zero. +const net = (benchmark, credit) => Math.max(0, (benchmark || 0) - (credit || 0)); + +/** + * Monthly amounts by income for 2026 and 2027 current law and 2027 under H.R. + * 1834: what the household pays for the benchmark plan after the credit + * (measure "net") or the credit itself (measure "credit"). + * + * `data` has the calculator API's fields: income, ptc_prior_year, ptc_baseline, + * ptc_ira, slcsp_by_income_prior_year, slcsp_by_income, fpl and year. + */ +function PremiumChart({ data, measure = "net", title }) { + const year = data?.year || 2027; + const hasPrior = Boolean(data?.ptc_prior_year?.length); + const fpl = data?.fpl || 0; + + const points = useMemo(() => { + if (!data?.income) return []; + // Show incomes up to a little past where H.R. 1834's credit ends. + let maxIncome = fpl * 8; + for (let i = data.ptc_ira.length - 1; i >= 0; i--) { + if (data.ptc_ira[i] > 0) { + maxIncome = Math.ceil(data.income[i] / 20000) * 20000 + 20000; + break; + } + } + return data.income + .map((income, i) => { + const point = { income }; + if (measure === "net") { + point.current = net(data.slcsp_by_income?.[i], data.ptc_baseline[i]) / 12; + point.revived = net(data.slcsp_by_income?.[i], data.ptc_ira[i]) / 12; + if (hasPrior) { + point.prior = net(data.slcsp_by_income_prior_year?.[i], data.ptc_prior_year[i]) / 12; + } + } else { + point.current = data.ptc_baseline[i] / 12; + point.revived = data.ptc_ira[i] / 12; + if (hasPrior) point.prior = data.ptc_prior_year[i] / 12; + } + return point; + }) + .filter((point) => point.income <= maxIncome); + }, [data, measure, hasPrior, fpl]); + + const lines = [ + hasPrior && { key: "prior", name: `${year - 1}, current law` }, + { key: "current", name: `${year}, current law` }, + { key: "revived", name: `${year}, H.R. 1834` }, + ].filter(Boolean); + + const CustomTooltip = ({ active, payload }) => { + if (!active || !payload?.length) return null; + const income = payload[0]?.payload?.income || 0; + return ( +
+

+ {formatCurrency(income)} + {fpl > 0 && ` (${Math.round((100 * income) / fpl)}% FPL)`} +

+ {payload.map((entry) => ( +

+ {entry.name}: {formatCurrency(entry.value)}/month +

+ ))} +
+ ); + }; + + const maxIncome = points.length ? points[points.length - 1].income : 0; + const xTicks = []; + for (let tick = 0; tick <= maxIncome; tick += 20000) xTicks.push(tick); + + return ( +
+ {title &&

{title}

} + + + + `$${(v / 1000).toFixed(0)}k`} + stroke="#6b7280" + fontSize={12} + label={{ value: "Household income", position: "bottom", offset: 40, fill: "#6b7280" }} + /> + formatCurrency(v)} + stroke="#6b7280" + fontSize={12} + label={{ + value: measure === "net" ? "Benchmark plan after credit, per month" : "Credit per month", + angle: -90, + position: "insideLeft", + offset: -30, + fill: "#6b7280", + style: { textAnchor: "middle" }, + }} + /> + } /> + + {fpl > 0 && ( + + )} + {lines.map(({ key, name }) => ( + + ))} + + +
+ ); +} + +export default PremiumChart; From 92e7f690de6aca8dfb0287b1b3ce6084f7b2ffeb Mon Sep 17 00:00:00 2001 From: David Trimmer Date: Mon, 9 Nov 2026 14:36:20 -0500 Subject: [PATCH 5/5] Label the premium chart's axis "Per month" The chart's title already names what it shows; the longer label could run past a short chart. Co-Authored-By: Claude Opus 5.5 (1M context) --- src/components/PremiumChart.jsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/PremiumChart.jsx b/src/components/PremiumChart.jsx index 1e95b05..9e57f7b 100644 --- a/src/components/PremiumChart.jsx +++ b/src/components/PremiumChart.jsx @@ -122,12 +122,11 @@ function PremiumChart({ data, measure = "net", title }) { stroke="#6b7280" fontSize={12} label={{ - value: measure === "net" ? "Benchmark plan after credit, per month" : "Credit per month", + value: "Per month", angle: -90, position: "insideLeft", - offset: -30, + offset: 10, fill: "#6b7280", - style: { textAnchor: "middle" }, }} /> } />