import { Bar, BarChart, CartesianGrid, Cell, ResponsiveContainer, Tooltip, XAxis, YAxis, } from 'recharts'; import type { FunnelStep } from '../types/api'; interface DropOffFunnelProps { steps: FunnelStep[]; compact?: boolean; } const STAGE_COLORS = ['#3b82f6', '#6366f1', '#8b5cf6', '#a855f7']; export function DropOffFunnel({ steps, compact = false }: DropOffFunnelProps) { const data = steps.map((s, i) => ({ stage: s.label ?? s.stage, count: s.count, dropOff: s.drop_off_pct ?? 0, fill: STAGE_COLORS[i % STAGE_COLORS.length], })); if (data.length === 0) { return (
Funnel data unavailable.
); } const height = compact ? 220 : 300; return (