import { useState } from 'react'; import { motion } from 'framer-motion'; import { Lightbulb, TrendingUp, ChevronDown } from 'lucide-react'; function stripMarkdown(text) { return String(text) .replace(/\*\*(.*?)\*\*/g, '$1') .replace(/\*(.*?)\*/g, '$1') .replace(/`([^`]+)`/g, '$1'); } export default function InsightBlock({ insights, explanation }) { const [expanded, setExpanded] = useState(true); const showToggle = insights?.length > 3; if (!insights?.length && !explanation) return null; return (
{/* SQL Reasoning */} {explanation && (
SQL Compilation Reasoning

{stripMarkdown(explanation)}

)} {/* AI Insights */} {insights?.length > 0 && (
Executive Insights {insights.length}
{showToggle && ( )}
)}
); }