'use client'; import { useState } from 'react'; import { Dialog, DialogTitle, DialogContent, DialogActions, } from '../../utils'; import { Typography } from '../../data-display'; import { Button, Select } from '../../inputs'; export type TableInfo = { table_name: string; }; export type DropTableDialogProps = { open: boolean; tables: TableInfo[]; onClose: () => void; onDrop: (tableName: string) => Promise; testId?: string; }; /** * DropTableDialog - A dialog for dropping/deleting database tables. * Displays a warning and requires table selection. */ export function DropTableDialog({ open, tables, onClose, onDrop, testId, }: DropTableDialogProps) { const [selectedTable, setSelectedTable] = useState(''); const [loading, setLoading] = useState(false); const handleDrop = async () => { if (!selectedTable) return; setLoading(true); try { await onDrop(selectedTable); handleClose(); } finally { setLoading(false); } }; const handleClose = () => { setSelectedTable(''); onClose(); }; return ( Drop Table Warning: This will permanently delete the table and all its data! ); } export default DropTableDialog;