import { Play } from 'lucide-react' import { type SqlSnippetSource } from '../../SQLEditor/querySource' import { type QueryResult } from '../types' import { QueryResultChart } from './QueryResultChart' import { QueryResultError } from './QueryResultError' import { DataGridResults } from '@/components/ui/DataGridResults' import { type ChartConfig } from '@/data/content/notebooks/notebook-schema' interface QueryResultRendererProps { result?: QueryResult view?: 'table' | 'chart' chart?: ChartConfig /** The query that produced `result`, used to build the "Debug with Assistant" prompt on error. */ sql?: string source?: SqlSnippetSource onDebug?: (prompt: string) => void } export const QueryResultRenderer = ({ result, view, chart, sql, source, onDebug, }: QueryResultRendererProps) => { const { rows, error, autoLimit } = result ?? {} if (!result) { return (

Run the query to see results

) } if (error) { return ( ) } if ((rows ?? []).length === 0) { return

Success. No rows returned

} if (rows && rows.length > 0) { if (view === 'table') return if (view === 'chart') return } return null }