"use client"; import Link from "next/link"; import { buttonVariants } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import { Megaphone, Image, Clock, Plus } from "lucide-react"; import { useEffect, useState } from "react"; interface Stats { activeCampaigns: number; pendingReview: number; publishedThisWeek: number; recentCampaigns: Array<{ id: string; name: string; status: string; createdAt: string; }>; } export default function DashboardPage() { const [stats, setStats] = useState(null); useEffect(() => { fetch("/api/stats") .then((r) => r.json()) .then(setStats) .catch(() => {}); }, []); const cards = [ { title: "Active Campaigns", value: stats?.activeCampaigns ?? 0, icon: Megaphone, description: "Currently running", }, { title: "Pending Review", value: stats?.pendingReview ?? 0, icon: Clock, description: "Assets awaiting approval", }, { title: "Published This Week", value: stats?.publishedThisWeek ?? 0, icon: Image, description: "Assets sent to platforms", }, ]; return (

Dashboard

New Campaign
{cards.map((card) => ( {card.title}
{card.value}

{card.description}

))}
Recent Campaigns Your latest marketing campaigns {stats?.recentCampaigns && stats.recentCampaigns.length > 0 ? (
{stats.recentCampaigns.map((campaign) => ( {campaign.name} {campaign.status} ))}
) : (

No campaigns yet. Create your first one to get started.

)}
); }