import React, { useState, useMemo } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { TrendingUp, Wallet, Landmark, ArrowRight, X, Info, Calculator, Percent, ShieldCheck } from 'lucide-react'; import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, AreaChart, Area } from 'recharts'; const CALCULATORS = [ { id: 'compound', tag: 'INVESTING', title: 'Compound Interest Calculator', description: 'Watch your money grow year by year with a live animated chart. Adjust return rate, contributions, and timeline.', icon: , color: 'border-blue-400', features: [ 'Year-by-year growth chart', 'Contribution vs. gain breakdown', 'Rule of 72 insight built in', 'Compare fee drag scenarios' ] }, { id: 'retirement', tag: 'RETIREMENT', title: 'Retirement Savings Calculator', description: 'Find your magic number — how much you need to retire, based on your spending, Social Security, and withdrawal rate.', icon: , color: 'border-amber-400', features: [ '4% rule & safe withdrawal modeling', 'Social Security income offset', 'On-track vs. gap analysis', 'Inflation-adjusted projections' ] }, { id: 'tax', tag: 'TAX STRATEGY', title: 'Roth vs. Traditional IRA', description: 'Side-by-side after-tax comparison at retirement. Select your current and expected future tax brackets.', icon: , color: 'border-purple-400', features: [ 'Current vs. retirement bracket selector', 'After-tax value comparison', 'Break-even tax rate shown', 'RMD impact explained' ] } ]; export default function FinancialCalculators() { const [activeCalc, setActiveCalc] = useState(null); return (

Institutional Planning Tools

Advanced modeling used by our private wealth advisors.

{CALCULATORS.map((calc) => ( setActiveCalc(calc)} /> ))}
{activeCalc && ( setActiveCalc(null)} /> )}
); } function CalculatorCard({ calc, onClick }) { return (
{calc.icon}
{calc.tag}

{calc.title}

{calc.description}

    {calc.features.map((feature, i) => (
  • {feature}
  • ))}
Open Calculator
); } function CalculatorModal({ calc, onClose }) { const [inputs, setInputs] = useState({ salary: 120000, contribution: 15, // percent has401k: true, employerMatch: 4, age: 30, retirementAge: 65, initialSavings: 50000, annualReturn: 7, taxBracket: 24, futureTaxBracket: 20 }); const handleInputChange = (e) => { const { name, value, type, checked } = e.target; setInputs(prev => ({ ...prev, [name]: type === 'checkbox' ? checked : parseFloat(value) })); }; const renderCalculatorContent = () => { switch (calc.id) { case 'compound': return ; case 'retirement': return ; case 'tax': return ; default: return null; } }; return (
{/* Sidebar / Inputs */}
{calc.icon}

{calc.tag}

GS ADVICE

{/* Main Content / Results */}

{calc.title}

Interactive projection based on institutional modeling.

{renderCalculatorContent()}
); } function InputGroup({ label, name, value, onChange, prefix, suffix, type = "number", min, max }) { return (
{type === "range" && {value}{suffix}}
{prefix && {prefix}} {suffix && type !== "range" && {suffix}}
); } function InvestmentAdvice({ inputs }) { const { salary, contribution, employerMatch } = inputs; const totalContribution = contribution + employerMatch; let advice = ""; if (totalContribution < 15) { advice = `Increase your total savings to at least 15% ($${(salary * 0.15 / 12).toLocaleString()} /mo) to remain on track for institutional-grade retirement.`; } else if (contribution > employerMatch + 10) { advice = "You are over-contributing to 401k. Consider diversifying into a brokerage account for liquidity or high-yield GS instruments."; } else { advice = "Excellent contribution level. Ensure your portfolio allocation matches your risk profile in the main dashboard."; } return

{advice}

; } // Calculator Logic Components function CompoundCalc({ inputs }) { const data = useMemo(() => { let current = inputs.initialSavings; let totalContributed = inputs.initialSavings; const yearlyReturn = inputs.annualReturn / 100; const yearlyContribution = (inputs.salary * (inputs.contribution / 100)); const results = []; for (let i = 0; i <= 30; i++) { results.push({ year: `Year ${i}`, balance: Math.round(current), contributions: Math.round(totalContributed) }); current = (current + yearlyContribution) * (1 + yearlyReturn); totalContributed += yearlyContribution; } return results; }, [inputs]); const finalBalance = data[data.length - 1].balance; return (

Estimated Value (30 Years)

${finalBalance.toLocaleString()}

Total Interest Earned

${(finalBalance - data[data.length-1].contributions).toLocaleString()}

`$${value / 1000}k`} axisLine={false} tickLine={false} tick={{fontSize: 12, fill: '#666'}} /> [`$${value.toLocaleString()}`, '']} contentStyle={{ borderRadius: '12px', border: 'none', boxShadow: '0 10px 15px -3px rgba(0, 0, 0, 0.1)' }} />
); } function RetirementCalc({ inputs }) { const { salary, contribution, employerMatch, initialSavings, annualReturn, age, retirementAge } = inputs; const yearsToRetirement = retirementAge - age; const annualContribution = salary * ((contribution + employerMatch) / 100); const rate = annualReturn / 100; // FV of current savings + FV of annual contributions const fvInitial = initialSavings * Math.pow(1 + rate, yearsToRetirement); const fvContributions = annualContribution * (Math.pow(1 + rate, yearsToRetirement) - 1) / rate; const projectedTotal = fvInitial + fvContributions; // Retirement Need: 80% of salary * 25 (4% rule) const annualNeed = salary * 0.8; const totalNeed = annualNeed * 25; const gap = totalNeed - projectedTotal; return (

Retirement Readiness Analysis

To maintain your lifestyle, you'll need approximately ${(totalNeed / 1000000).toFixed(1)}M. Your current path projects a fund of ${(projectedTotal / 1000000).toFixed(1)}M in {yearsToRetirement} years.

Current Plan

${(projectedTotal / 1000000).toFixed(2)}M

Projected {gap > 0 ? 'Gap' : 'Surplus'}

0 ? 'text-red-500' : 'text-green-600'}`}> ${Math.abs(gap / 1000000).toFixed(2)}M

Savings Rate

{contribution + employerMatch}%

PROJECTION BASIS: Assumes {annualReturn}% annual return, inflation-adjusted spending, and adherence to the 4% safe withdrawal rule. Modeling includes GS institutional market assumptions.

); } function TaxCalc({ inputs }) { const { salary, contribution, initialSavings, annualReturn, age, retirementAge, taxBracket, futureTaxBracket } = inputs; const years = retirementAge - age; const rate = annualReturn / 100; const annualContribution = salary * (contribution / 100); // Traditional IRA: Invest pre-tax, pay tax at withdrawal const tradFV_Initial = initialSavings * Math.pow(1 + rate, years); const tradFV_Cont = annualContribution * (Math.pow(1 + rate, years) - 1) / rate; const tradNet = (tradFV_Initial + tradFV_Cont) * (1 - (futureTaxBracket / 100)); // Roth IRA: Invest after-tax, tax-free withdrawal const rothInitial = initialSavings * (1 - (taxBracket / 100)); const rothAnnual = annualContribution * (1 - (taxBracket / 100)); const rothFV_Initial = rothInitial * Math.pow(1 + rate, years); const rothFV_Cont = rothAnnual * (Math.pow(1 + rate, years) - 1) / rate; const rothNet = rothFV_Initial + rothFV_Cont; const winner = rothNet > tradNet ? "Roth" : "Traditional"; const diffPercent = Math.abs(((rothNet - tradNet) / Math.min(rothNet, tradNet)) * 100).toFixed(1); return (

Roth Strategy {winner === 'Roth' && OPTIMAL}

Pay taxes now at {taxBracket}%. All future growth and withdrawals are 100% Tax-Free.

${(rothNet / 1000).toFixed(0)}k

Estimated Net Wealth

Traditional {winner === 'Traditional' && OPTIMAL}

Get a tax deduction now. Entire balance is taxed at {futureTaxBracket}% during retirement.

${(tradNet / 1000).toFixed(0)}k

Estimated Net Wealth

Strategic Selection

The {winner} Strategy is projected to provide {diffPercent}% more spendable wealth.

Difference

${Math.abs((rothNet - tradNet) / 1000).toFixed(0)}k

); }