"use client"; import { Package, CalendarCheck, Clock, TrendingUp } from "lucide-react"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import { useAdmin } from "@/contexts/AdminContext"; export default function AdminOverview() { const { products, reservations } = useAdmin(); const pending = reservations.filter((r) => r.status === "pending").length; const confirmed = reservations.filter((r) => r.status === "confirmed").length; const totalValue = products.reduce((sum, p) => sum + p.price, 0); const stats = [ { label: "Produits", value: products.length, icon: Package, color: "text-blue-600", bg: "bg-blue-100" }, { label: "RDV en attente", value: pending, icon: Clock, color: "text-amber-600", bg: "bg-amber-100" }, { label: "RDV confirmés", value: confirmed, icon: CalendarCheck, color: "text-green-600", bg: "bg-green-100" }, { label: "Valeur catalogue", value: `${totalValue} €`, icon: TrendingUp, color: "text-primary", bg: "bg-primary/10" }, ]; const upcoming = [...reservations] .filter((r) => r.status !== "cancelled") .sort((a, b) => `${a.date}${a.time}`.localeCompare(`${b.date}${b.time}`)) .slice(0, 5); return (

Vue d'ensemble

Aperçu de votre activité

{stats.map((s) => (

{s.label}

{s.value}

))}
Prochains rendez-vous {upcoming.length === 0 ? (

Aucun rendez-vous à venir.

) : (
{upcoming.map((r) => (

{r.clientName}

{r.service}

{new Date(r.date).toLocaleDateString("fr-FR", { day: "2-digit", month: "short" })} à {r.time}

{r.status === "confirmed" ? "Confirmé" : "En attente"}
))}
)}
); };