diff --git a/dashboard/app/project/[id]/dashboard-charts.tsx b/dashboard/app/project/[id]/dashboard-charts.tsx index 134c4a157..5e4265d44 100644 --- a/dashboard/app/project/[id]/dashboard-charts.tsx +++ b/dashboard/app/project/[id]/dashboard-charts.tsx @@ -1,6 +1,6 @@ "use client"; -import React, { memo, useMemo, cloneElement } from "react"; +import React, { memo, useMemo } from "react"; import { Loader2 } from "lucide-react"; import { Card, CardContent } from "@/components/ui/card"; import { @@ -346,15 +346,9 @@ export const ChartWrapper = memo(function ChartWrapper({ ); } - // Clone the chart element and inject responsive prop and style - const chartWithResponsive = cloneElement(children as React.ReactElement<{ responsive?: boolean; style?: React.CSSProperties }>, { - responsive: true, - style: { width: "100%", height: "100%" }, - }); - return ( - {chartWithResponsive} + {children} ); }); diff --git a/dashboard/components/ui/chart.tsx b/dashboard/components/ui/chart.tsx index 2d6e60460..bffc7c8f6 100644 --- a/dashboard/components/ui/chart.tsx +++ b/dashboard/components/ui/chart.tsx @@ -80,7 +80,9 @@ function ChartContainer({ ...props }: React.ComponentProps<"div"> & { config: ChartConfig - children: React.ReactNode + children: React.ComponentProps< + typeof RechartsPrimitive.ResponsiveContainer + >["children"] }) { const uniqueId = React.useId() const chartId = `chart-${id || uniqueId.replace(/:/g, "")}` @@ -91,13 +93,15 @@ function ChartContainer({ data-slot="chart" data-chart={chartId} className={cn( - "[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden", + "[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden", className )} {...props} > - {children} + + {children} + )