import { useState } from "react"; import { exportReport } from "../utils/exportReport"; /** * Button to export simulation results as a downloadable PDF report. */ export function ExportButton({ result, scenario, chartRef }) { const [exporting, setExporting] = useState(false); async function handleExport() { setExporting(true); try { const chartElement = chartRef?.current || null; await exportReport(result, scenario, chartElement); } catch (err) { console.error("Export failed:", err); alert("Export failed. Please try again."); } finally { setExporting(false); } } return (
Download a formatted PDF report with scenario inputs, growth chart, risk analysis, and recommendations.