'use client'; import { useState } from 'react'; import { Box } from '../../layout'; import { Paper } from '../../surfaces'; import { Typography } from '../../data-display'; import { Button, TextField } from '../../inputs'; import { CircularProgress } from '../../feedback'; export type SQLQueryTabProps = { onExecuteQuery: (query: string) => Promise; title?: string; description?: string; placeholder?: string; testId?: string; }; /** * SQLQueryTab - A component for executing raw SQL queries. * Provides a text area for query input and execute button. */ export function SQLQueryTab({ onExecuteQuery, title = 'SQL Query Interface', description, placeholder = 'SELECT * FROM your_table LIMIT 10;', testId, }: SQLQueryTabProps) { const [queryText, setQueryText] = useState(''); const [loading, setLoading] = useState(false); const handleExecute = async () => { if (!queryText.trim()) { return; } setLoading(true); try { await onExecuteQuery(queryText); } finally { setLoading(false); } }; return ( {title} {description && ( {description} )} setQueryText(e.target.value)} placeholder={placeholder} sx={{ mb: 2 }} /> ); } export default SQLQueryTab;