import { CalendarCheck, Users, Bot, Images, TrendingUp, TrendingDown } from "lucide-react"; import { useQuery } from "@tanstack/react-query"; export default function StatsCards() { const { data: stats, isLoading } = useQuery({ queryKey: ["/api/stats"], }); const statCards = [ { icon: CalendarCheck, iconColor: "from-blue-500 to-blue-600", title: (stats as any)?.scheduledPosts ?? 0, subtitle: "Publications planifiées", change: "+12%", trending: "up", changeLabel: "vs mois dernier", }, { icon: Users, iconColor: "from-purple-500 to-purple-600", title: (stats as any)?.connectedPages ?? 0, subtitle: "Pages connectées", info: "Facebook • Instagram", }, { icon: Bot, iconColor: "from-green-500 to-green-600", title: (stats as any)?.aiTextsGenerated ?? 0, subtitle: "Textes générés par IA", change: "+8%", trending: "up", changeLabel: "vs hier", }, { icon: Images, iconColor: "from-cyan-500 to-cyan-600", title: (stats as any)?.mediaStored ?? 0, subtitle: "Médias stockés", info: "Images • Vidéos", }, ]; if (isLoading) { return (
{[1, 2, 3, 4].map((i) => (
))}
); } return (
{statCards.map((stat, index) => { const Icon = stat.icon; const TrendIcon = stat.trending === "up" ? TrendingUp : TrendingDown; return (

{stat.title}

{stat.subtitle}

{stat.change && (
{stat.change}
{stat.changeLabel}
)} {stat.info && (
{stat.info}
)}
); })}
); }