"use client"; import { useEffect, useState } from "react"; import Link from "next/link"; import { Button } from "@/components/ui/button"; import { buttonVariants } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; interface TrendReport { id: string; name: string; filePath: string; summary?: string | null; createdAt: string; } export default function TrendsPage() { const [reports, setReports] = useState([]); const [selectedReport, setSelectedReport] = useState(null); useEffect(() => { fetch("/api/stats") .then((r) => r.json()) .then((data) => { if (data.trendReports) setReports(data.trendReports); }) .catch(() => {}); }, []); return (

Trend Reports

{reports.length === 0 ? (

No trend reports yet. Run the Trend Scout agent to generate reports.

) : (
{reports.map((report) => ( setSelectedReport(report)} > {report.name} {new Date(report.createdAt).toLocaleDateString()} {report.summary && (

{report.summary}

)} Create Campaign from This
))}
)} {/* Report Viewer */} {selectedReport && (
{selectedReport.name}