"use client"; import { TrendingUp } from "lucide-react"; import { LineChart, Line, XAxis, YAxis, Tooltip, ResponsiveContainer, CartesianGrid, } from "recharts"; import { TrendScore } from "@/lib/types"; import { formatDate } from "@/lib/utils"; interface TrendChartProps { data?: TrendScore[]; } export function TrendChart({ data }: TrendChartProps) { const chartData = data?.map((d) => ({ date: new Date(d.score_date).toLocaleDateString("en-US", { month: "short", day: "numeric" }), score: Math.round(d.composite_score), news: d.newsapi_count, gnews: d.gnews_count, })) ?? []; const latest = data?.[data.length - 1]?.composite_score; return (

Public Interest

{latest !== undefined && ( {Math.round(latest)} )}
{chartData.length === 0 ? (

Trend data not yet available.

) : ( )}
Score: 0–100 composite NewsAPI + Google News + Trends
); }