import { useGameStore } from '@/store'; import { formatMoney, formatPercent, FUNDING_ROUNDS } from '@ai-tycoon/shared'; import type { FundingRoundType } from '@ai-tycoon/shared'; import { TrendingUp, DollarSign, PiggyBank, BarChart3, Rocket } from 'lucide-react'; import { AreaChart, Area, XAxis, YAxis, ResponsiveContainer, LineChart, Line } from 'recharts'; import { canRaiseFunding } from '@ai-tycoon/game-engine'; import type { GameState } from '@ai-tycoon/shared'; export function FinancePage() { const money = useGameStore((s) => s.economy.money); const revenuePerTick = useGameStore((s) => s.economy.revenuePerTick); const expensesPerTick = useGameStore((s) => s.economy.expensesPerTick); const funding = useGameStore((s) => s.economy.funding); const history = useGameStore((s) => s.economy.financialHistory); const infrastructure = useGameStore((s) => s.infrastructure); const talent = useGameStore((s) => s.talent); const raiseFunding = useGameStore((s) => s.raiseFunding); const state = useGameStore.getState(); const gameStateForFunding: GameState = { meta: state.meta, economy: state.economy, infrastructure: state.infrastructure, compute: state.compute, research: state.research, models: state.models, market: state.market, competitors: state.competitors, talent: state.talent, data: state.data, reputation: state.reputation, events: state.events, achievements: state.achievements, }; const fundingStatus = canRaiseFunding(gameStateForFunding); const netIncome = revenuePerTick - expensesPerTick; const burnRate = expensesPerTick > revenuePerTick ? expensesPerTick - revenuePerTick : 0; const runway = burnRate > 0 ? money / burnRate : Infinity; const infraCosts = infrastructure.dataCenters.reduce( (s, dc) => s + dc.energyCostPerTick + dc.maintenanceCostPerTick, 0, ); const talentCosts = talent.totalSalaryPerTick; return (
No funding rounds completed yet.
) : (