import { useMemo } from 'react'; import { Responsive } from 'react-grid-layout'; import WidthProvider from 'react-grid-layout'; import { useDashboardStore } from '../store/dashboardStore'; import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { X } from "lucide-react"; import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, LineChart, Line } from 'recharts'; import 'react-grid-layout/css/styles.css'; import 'react-resizable/css/styles.css'; export function Dashboard() { const { charts, removeChart } = useDashboardStore(); const ResponsiveGridLayout = useMemo(() => WidthProvider(Responsive as any) as any, []); const layouts = useMemo(() => ({ lg: charts.map((c) => c.layout) }), [charts]); const onLayoutChange = (_currentLayout: any, _allLayouts: any) => { // updateLayout(currentLayout); // This might cause infinite loops if not handled carefully // For simplicity, we just log it or update it if needed. // In a real app, we would debounce this and save to backend. }; if (charts.length === 0) { return (
No charts in dashboard.
Go to Chat and add some visualizations!