'use client'; import { TrendChart } from '@/components/data/trend-chart'; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from '@/components/ui/card'; import type { TrafficTrendPoint } from '@/lib/services/openflare'; import { formatTrendHour } from './dashboard-utils'; export function TrafficTrendChart({ points, title = '24 小时请求趋势', description = '观察整体请求量和错误量是否出现异常抬升。', }: { points: TrafficTrendPoint[]; title?: string; description?: string; }) { return ( {title} {description} formatTrendHour(point.bucket_started_at), )} summaryScope='total' summaryHint='近 24 小时' series={[ { label: '请求量', color: '#f59e0b', fillColor: 'rgba(245, 158, 11, 0.18)', variant: 'area', values: points.map((point) => point.request_count), }, { label: '错误量', color: '#ef4444', values: points.map((point) => point.error_count), }, ]} /> ); }