import { useState } from 'react'; import { LineChart, Line, XAxis, YAxis, Tooltip, ResponsiveContainer, Area, AreaChart } from 'recharts'; interface Props { data: { date: string; price: number }[]; } export default function PriceHistoryChart({ data }: Props) { const [range, setRange] = useState<30 | 90 | 365>(30); const filtered = data.slice(-range); const min = Math.floor(Math.min(...filtered.map(d => d.price)) - 5); const max = Math.ceil(Math.max(...filtered.map(d => d.price)) + 5); const ranges = [ { value: 30 as const, label: '30D' }, { value: 90 as const, label: '90D' }, { value: 365 as const, label: '1J' }, ]; return (