// Production - The Idle Game: Corporate IPO & Boardroom Perks View import { BOARDROOM_PERKS, calculateSharesEarned, IPO_MIN_VALUATION } from '../data/boardroom.js'; import { fmtCurrency, fmtNum } from '../core/formatters.js'; export function renderBoardroom(container, state, onAction) { const earnedShares = calculateSharesEarned(state.lifetimeRevenue); const canIPO = state.lifetimeRevenue >= IPO_MIN_VALUATION; const perks = state.boardroomPerks || {}; let html = `
Executive Boardroom

Corporate IPO & Venture Capital

Take your manufacturing conglomerate public on the global securities exchange. Liquidate current factories to secure permanent Venture Shares ($V-Shares), funding cutting-edge R&D and boardroom privileges.

Corporate Enterprise Valuation
${fmtCurrency(state.valuation)}
Lifetime Gross Revenue: ${fmtCurrency(state.lifetimeRevenue)}
+${fmtNum(earnedShares, 0)} $V-Shares

Initial Public Offering (IPO) Ready

${canIPO ? `Execute corporate IPO now to claim ${fmtNum(earnedShares, 0)} Venture Shares and restart with permanent bonuses.` : `Requires minimum ${fmtCurrency(IPO_MIN_VALUATION)} in lifetime revenue to file for IPO.`}

Available $V-Shares: ${fmtNum(state.ventureShares, 0)}
IPOs Completed: ${state.ipoCount || 0}

Boardroom R&D Tech Tree

Permanent corporate privileges that persist across all future IPO expansions
`; for (const perk of BOARDROOM_PERKS) { const currentLvl = perks[perk.id] || 0; const isMaxed = currentLvl >= perk.maxLevel; const nextCost = !isMaxed ? perk.costShares[currentLvl] : 0; const canAfford = state.ventureShares >= nextCost && !isMaxed; html += `
Level ${currentLvl} / ${perk.maxLevel}

${perk.name}

${perk.description}

${perk.effectDesc}
`; } html += `
`; container.innerHTML = html; const ipoBtn = container.querySelector('.btn-ipo-trigger'); if (ipoBtn) { ipoBtn.onclick = () => onAction({ type: 'TRIGGER_IPO' }); } container.querySelectorAll('.btn-buy-perk').forEach(btn => { btn.onclick = () => onAction({ type: 'BUY_PERK', perkId: btn.dataset.perk }); }); }