"use client" import { useState } from "react" import { Button } from "@/components/ui/button" import { Badge } from "@/components/ui/badge" import { XAxis, YAxis, ResponsiveContainer, Tooltip, Area, AreaChart } from "recharts" import { useTheme } from "next-themes" interface StockChartProps { symbol: string } const timeRanges = [ { label: "1D", value: "1D" }, { label: "5D", value: "5D" }, { label: "1M", value: "1M" }, { label: "6M", value: "6M" }, { label: "YTD", value: "YTD" }, { label: "1Y", value: "1Y" }, { label: "5Y", value: "5Y" }, { label: "MAX", value: "MAX" }, ] // Mock chart data const generateChartData = () => { const data = [] const basePrice = 420 for (let i = 0; i < 100; i++) { const time = new Date(Date.now() - (100 - i) * 60 * 60 * 1000).toLocaleTimeString("en-US", { hour: "2-digit", minute: "2-digit", }) const price = basePrice + Math.sin(i / 10) * 20 + (Math.random() - 0.5) * 10 data.push({ time, price: price.toFixed(2), volume: Math.floor(Math.random() * 1000000), }) } return data } export function StockChart({ symbol }: StockChartProps) { const [selectedRange, setSelectedRange] = useState("1D") const [chartData] = useState(generateChartData()) const { theme } = useTheme() const currentPrice = Number.parseFloat(chartData[chartData.length - 1]?.price || "0") const previousPrice = Number.parseFloat(chartData[0]?.price || "0") const isPositive = currentPrice > previousPrice const isDark = theme === "dark" const axisColor = isDark ? "#e5e7eb" : "hsl(var(--muted-foreground))" const strokeColor = isDark ? "#60a5fa" : "hsl(var(--primary))" const gradientStopColor = isDark ? "#60a5fa" : "hsl(var(--primary))" return (