feat: add project

This commit is contained in:
qixinbo
2026-03-16 16:12:35 +08:00
parent 1354a0cbc6
commit cec5fde098
23 changed files with 990 additions and 179 deletions
@@ -7,6 +7,7 @@ import { Code, Table as TableIcon, BarChart as ChartIcon, Download, LayoutDashbo
import { ScrollArea } from "@/components/ui/scroll-area";
import { useDashboardStore, type ChartConfig } from "@/store/dashboardStore";
import { useVisualizationStore } from "@/store/visualizationStore";
import { useProjectStore } from "@/store/projectStore";
import { VegaChart } from "./VegaChart";
export function VisualizationPanel() {
@@ -14,6 +15,7 @@ export function VisualizationPanel() {
const [confirmOpen, setConfirmOpen] = useState(false);
const [pendingChart, setPendingChart] = useState<Omit<ChartConfig, 'layout'> | null>(null);
const { addChart } = useDashboardStore();
const { currentProject } = useProjectStore();
const { currentData, currentSQL, currentChartSpec, currentChartInfo, isLoading, error } = useVisualizationStore();
const buildPendingChart = (): Omit<ChartConfig, 'layout'> | null => {
@@ -32,6 +34,7 @@ export function VisualizationPanel() {
};
const handleAddToDashboard = () => {
if (!currentProject) return;
const chart = buildPendingChart();
if (!chart) return;
setPendingChart(chart);
@@ -39,8 +42,8 @@ export function VisualizationPanel() {
};
const handleConfirmAdd = () => {
if (!pendingChart) return;
addChart(pendingChart);
if (!pendingChart || !currentProject) return;
addChart(pendingChart, currentProject.id);
setConfirmOpen(false);
setPendingChart(null);
};