import { Activity, ArrowUp, Clock, Database, GitMerge, Hash, Zap } from 'lucide-react' import { Badge } from 'ui' export interface ExplainSummary { totalTime: number hasSeqScan: boolean hasIndexScan: boolean } export interface ExplainHeaderProps { mode: 'visual' | 'raw' onToggleMode: () => void summary?: ExplainSummary } export function ExplainHeader({ mode, onToggleMode, summary }: ExplainHeaderProps) { const isVisual = mode === 'visual' const hasSummaryStats = isVisual && summary && (summary.totalTime > 0 || (summary.hasSeqScan && !summary.hasIndexScan)) return (
{/* Title row */}

Query Execution Plan

{/* How to read */}
How to read: Start at the bottom where data is read from tables, then follow upward as each step processes the results.
{/* Summary stats - only show in visual mode when we have the data */} {hasSummaryStats && (
{summary.totalTime > 0 && (
Total: {summary.totalTime.toFixed(2)}ms
)} {summary.hasSeqScan && !summary.hasIndexScan && ( Sequential scan detected )}
)} {/* Icon legend - only relevant in visual mode */} {isVisual && (
Seq Scan (full table read)
Index Scan (fast lookup)
Join
Hash (lookup table)
)}
) }