import React from "react"; import { LineChart, Line, ResponsiveContainer } from "recharts"; interface TrendDataPoint { time: string; value: number; value2?: number; // Optional second value for dual-line charts } interface TinyTrendChartProps { data: TrendDataPoint[]; color: string; color2?: string; // Optional second color for dual-line className?: string; isDual?: boolean; // Flag to enable dual-line mode } export function TinyTrendChart({ data, color, color2, className, isDual = false, }: TinyTrendChartProps) { // Generate unique IDs for animation elements const chartId = React.useId(); // Add subtle flowing line animations React.useEffect(() => { const style = document.createElement("style"); style.textContent = ` @keyframes subtleWave { 0% { opacity: 0.7; stroke-width: 1; stroke-dasharray: 100 0; stroke-dashoffset: 0; } 25% { opacity: 0.9; stroke-width: 1.1; stroke-dasharray: 80 20; stroke-dashoffset: -10; } 50% { opacity: 1; stroke-width: 1.2; stroke-dasharray: 60 40; stroke-dashoffset: -20; } 75% { opacity: 0.9; stroke-width: 1.1; stroke-dasharray: 80 20; stroke-dashoffset: -30; } 100% { opacity: 0.7; stroke-width: 1; stroke-dasharray: 100 0; stroke-dashoffset: -40; } } .animated-line { animation: subtleWave 4s ease-in-out infinite; transition: all 0.3s ease; } `; document.head.appendChild(style); return () => { document.head.removeChild(style); }; }, []); // Use actual data - no fallbacks const chartData = data; // Show empty state if no data if (!chartData || chartData.length === 0) { return (
No data
); } return (
{/* Glass overlay effect */}
{isDual && color2 && ( )}
); }