"use client"; import { useState } from "react"; import { Sparkline } from "@/components/chat/sparkline"; import { Card } from "@/components/ui/card"; import { Dialog, DialogDescription, DialogHeader, DialogPanel, DialogPopup, DialogTitle, } from "@/components/ui/dialog"; import type { TrendPoint } from "@/lib/analytics"; // A KPI card with an inline line chart (Sparkline). Clicking it opens a dialog // with the full line chart and a per-point breakdown. Used on the Analysis page. export function TrendCard({ title, description, points, emptyLabel, detailsLabel, }: { title: string; description: string; points: TrendPoint[]; emptyLabel: string; detailsLabel: string; }) { const [open, setOpen] = useState(false); const values = points.map((p) => p.count); const total = values.reduce((a, b) => a + b, 0); const hasData = points.length > 0; return ( <> {title} {description}
{points.map((p) => (
{p.label}
{p.count}
))}
); }