import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { Badge } from "@/components/ui/badge"; import { ArrowUpRight, Calendar, DollarSign, Users, Clock, } from "lucide-react"; import useDashboardStats from "@/hooks/useDashboardStats"; import { formatDistanceToNow } from "date-fns"; import { fr } from "date-fns/locale"; export default function ArtisanStats() { const { totalQuotes, acceptanceRate, totalProjects, completedProjects, totalAppointments, pendingAppointments, totalRevenue, pendingRevenue, recentActivity, isLoading } = useDashboardStats(); // Calculs pour l'affichage const acceptedQuotes = Math.round(totalQuotes * (acceptanceRate / 100)); const pendingQuotes = totalQuotes - acceptedQuotes - 2; // Supposons 2 rejetés const rejectedQuotes = 2; const inProgressProjects = totalProjects - completedProjects; const completedAppointments = totalAppointments - pendingAppointments; if (isLoading) { return
Chargement des statistiques...
; } return (

Statistiques

Devis
{totalQuotes}

{pendingQuotes} en attente

{acceptedQuotes} acceptés {rejectedQuotes} refusés
Projets
{totalProjects}

{inProgressProjects} en cours

{completedProjects} terminés
Rendez-vous
{totalAppointments}

{pendingAppointments} à venir

{completedAppointments} terminés
Revenus
{totalRevenue.toLocaleString('fr-FR')} €

{pendingRevenue.toLocaleString('fr-FR')} € en attente

{(pendingRevenue + totalRevenue).toLocaleString('fr-FR')} € potentiels
Vue d'ensemble Devis Rendez-vous Revenus Activité récente {recentActivity && recentActivity.length > 0 ? (
{recentActivity.map((activity, index) => (

{activity.title}

{formatDistanceToNow(activity.date, { addSuffix: true, locale: fr })}

))}
) : (

Aucune activité récente à afficher.

)}
Devis récents

Aucun devis récent à afficher.

Rendez-vous à venir

Aucun rendez-vous à venir à afficher.

Revenus récents

Aucun revenu récent à afficher.

); }