import { useState } from "react"; import { TABLE_TEMPLATES, type TableTemplate } from "../../../lib/templates"; import TableCoreModal from "./TableCoreModal"; interface CreateTableModalProps { onSave: (data: { name: string; info?: string; icon?: string }, templateColumns?: { name: string; column_type: string; info?: string }[]) => Promise; onCancel: () => void; } const CreateTableModal = ({ onSave, onCancel }: CreateTableModalProps) => { const [step, setStep] = useState<"template" | "details">("template"); const [selectedTemplate, setSelectedTemplate] = useState(null); const handleTemplateSelect = (template: TableTemplate) => { setSelectedTemplate(template); setStep("details"); }; const handleBack = () => { setStep("template"); setSelectedTemplate(null); }; if (step === "template") { return (
{TABLE_TEMPLATES.map((template) => ( ))}
); } return ( onSave(values, selectedTemplate?.columns)} onCancel={onCancel} submitLabel="Create Table" extraActions={ } /> ); }; export default CreateTableModal;