import { useState } from 'react'; import { LineChart, BarChart2, DollarSign, TrendingUp } from 'lucide-react'; export default function MarketingMixSimulator() { const [channels, setChannels] = useState({ tv: 30, social: 20, search: 25, email: 15, display: 10 }); const [baselineSales] = useState(1000000); // Simulated effectiveness coefficients const coefficients = { tv: 2.5, social: 1.8, search: 2.2, email: 1.5, display: 1.3 }; // Calculate impact on sales const calculateImpact = () => { return Object.entries(channels).reduce((total, [channel, spend]) => { return total + (spend * 10000 * coefficients[channel]); }, baselineSales); }; const totalSales = calculateImpact(); const roi = ((totalSales - baselineSales) / (Object.values(channels).reduce((a, b) => a + b, 0) * 10000) * 100).toFixed(1); const handleChange = (channel, value) => { setChannels(prev => ({ ...prev, [channel]: parseInt(value) })); }; return (

Marketing Mix Simulator

{/* Metrics Overview */}

Total Budget

${(Object.values(channels).reduce((a, b) => a + b, 0) * 10000).toLocaleString()}

Projected Sales

${totalSales.toLocaleString()}

ROI

{roi}%

{/* Channel Controls */}

Channel Budget Allocation (%)

{Object.entries(channels).map(([channel, value]) => (
${(value * 10000).toLocaleString()}
handleChange(channel, e.target.value)} className="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-blue-600" />
0% {value}% 100%
))}
{/* Channel Impact Visualization */}

Channel Impact

{Object.entries(channels).map(([channel, value]) => (
{channel}
))}
); }