"use client" import { useEffect, useState } from "react"; import { BarChart, Bar, Rectangle, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer, LabelList, Line, LineChart } from "recharts"; import { ChartConfig, ChartContainer, ChartTooltip, ChartTooltipContent, } from "@/components/ui/chart" import FetchWrapper from '@/hooks/FetchWrapper'; const CustomTooltip = ({ active, payload, label }) => { if (active && payload && payload.length) { return (

{label}

Total: {payload[0].value} Leads

); } return null; }; const chartConfig = { desktop: { label: "Desktop", color: "hsl(var(--chart-1))", }, mobile: { label: "Mobile", color: "hsl(var(--chart-2))", }, } satisfies ChartConfig export function OverviewChart({ dateFrom = '', dateTo = '' }) { const [isLoading, setIsLoading] = useState(true); const [chartData, setChartData] = useState([]); useEffect(() => { const api = new FetchWrapper(advico_plugin.pluginApiUrl, advico_plugin.nonce); api.get(`/overview/chart`) .then(data => { setChartData(data.data); setIsLoading(false); }) .catch(error => { console.error("Error fetching data:", error); }); }, []); return ( <> value.slice(0, 3)} /> } /> ) }