import AdminLayout from "@/components/AdminLayout"; import { trpc } from "@/lib/trpc"; import { Building2, Mic2, Radio, FileText, TrendingUp, ArrowRight } from "lucide-react"; import { Link } from "wouter"; import { Button } from "@/components/ui/button"; const ARTWORK_COLORS = [ "from-blue-500 to-indigo-600", "from-violet-500 to-purple-700", "from-emerald-500 to-teal-600", "from-orange-500 to-red-600", "from-cyan-500 to-blue-600", "from-rose-500 to-pink-600", "from-amber-500 to-orange-600", "from-indigo-500 to-blue-700", ]; export default function AdminDashboard() { const { data: stats, isLoading } = trpc.podcasts.stats.useQuery(); const { data: recentPodcasts } = trpc.podcasts.list.useQuery({ statut: undefined }); const statCards = [ { title: "Total podcasts", value: stats?.total ?? 0, icon: Mic2, gradient: "from-blue-500 to-indigo-600", textColor: "text-blue-600", bgLight: "bg-blue-50", change: null, }, { title: "Publiés", value: stats?.publies ?? 0, icon: Radio, gradient: "from-emerald-500 to-teal-600", textColor: "text-emerald-600", bgLight: "bg-emerald-50", change: null, }, { title: "Brouillons", value: stats?.brouillons ?? 0, icon: FileText, gradient: "from-amber-500 to-orange-500", textColor: "text-amber-600", bgLight: "bg-amber-50", change: null, }, { title: "Établissements", value: stats?.etablissements ?? 0, icon: Building2, gradient: "from-violet-500 to-purple-600", textColor: "text-violet-600", bgLight: "bg-violet-50", change: null, }, ]; return (
{/* ── Header ── */}

Tableau de bord

Vue d'ensemble de la plateforme Itinova Podcasts

Plateforme active
{/* ── Stat cards ── */}
{statCards.map((card) => (
{/* Gradient accent top */}

{card.title}

{isLoading ? ( ) : card.value}

))}
{/* ── Taux de publication ── */} {stats && stats.total > 0 && (
Taux de publication
{Math.round((stats.publies / stats.total) * 100)}%
{stats.publies} publié{stats.publies !== 1 ? "s" : ""} {stats.brouillons} brouillon{stats.brouillons !== 1 ? "s" : ""}
)} {/* ── Podcasts récents ── */}

Podcasts récents

Voir tout
{!recentPodcasts || recentPodcasts.length === 0 ? (

Aucun podcast pour l'instant

Commencez par créer votre premier podcast

) : (
{recentPodcasts.slice(0, 6).map((p) => { const colorClass = ARTWORK_COLORS[p.id % ARTWORK_COLORS.length]; return (
{/* Artwork */}
{/* Info */}

{p.titre}

{p.etablissementNom}

{/* Badge statut */} {p.statut === "publie" ? "Publié" : "Brouillon"} {/* Action */} Éditer
); })}
)}
); }