'use client';

import { ResponsiveContainer } from 'recharts';

interface SafeChartProps {
  width?: string | number;
  height: number | string;
  children: React.ReactNode;
}

export function SafeChart({ width = '100%', height, children }: SafeChartProps) {
  return (
    <div style={{ width, height, minWidth: 1, minHeight: 1 }}>
      <ResponsiveContainer width="100%" height="100%">
        {children as React.ReactElement}
      </ResponsiveContainer>
    </div>
  );
}
