feat: add SQL editor, query results, and workspace panels
Add CodeMirror 6 SQL editor with Ctrl+Enter execution, ResultsTable with virtual scrolling and resizable columns, ResultsPanel, EditableCell, WorkspacePanel (editor + results split), and TabContent router. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
49
src/components/workspace/TabContent.tsx
Normal file
49
src/components/workspace/TabContent.tsx
Normal file
@@ -0,0 +1,49 @@
|
||||
import { useAppStore } from "@/stores/app-store";
|
||||
import { WorkspacePanel } from "./WorkspacePanel";
|
||||
import { TableDataView } from "@/components/table-viewer/TableDataView";
|
||||
import { TableStructure } from "@/components/table-viewer/TableStructure";
|
||||
|
||||
export function TabContent() {
|
||||
const { tabs, activeTabId, updateTab } = useAppStore();
|
||||
const activeTab = tabs.find((t) => t.id === activeTabId);
|
||||
|
||||
if (!activeTab) {
|
||||
return (
|
||||
<div className="flex h-full items-center justify-center text-sm text-muted-foreground">
|
||||
Open a query tab or select a table to get started.
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
switch (activeTab.type) {
|
||||
case "query":
|
||||
return (
|
||||
<WorkspacePanel
|
||||
key={activeTab.id}
|
||||
connectionId={activeTab.connectionId}
|
||||
initialSql={activeTab.sql}
|
||||
onSqlChange={(sql) => updateTab(activeTab.id, { sql })}
|
||||
/>
|
||||
);
|
||||
case "table":
|
||||
return (
|
||||
<TableDataView
|
||||
key={activeTab.id}
|
||||
connectionId={activeTab.connectionId}
|
||||
schema={activeTab.schema!}
|
||||
table={activeTab.table!}
|
||||
/>
|
||||
);
|
||||
case "structure":
|
||||
return (
|
||||
<TableStructure
|
||||
key={activeTab.id}
|
||||
connectionId={activeTab.connectionId}
|
||||
schema={activeTab.schema!}
|
||||
table={activeTab.table!}
|
||||
/>
|
||||
);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user