"use client"; import { Cpu } from "lucide-react"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import type { TranslationStatsData } from "./types"; interface ProviderBreakdownChartProps { data: TranslationStatsData | null; isLoading: boolean; } const providerLabels: Record = { google: "Google Translate", ollama: "Ollama (Local)", openai: "OpenAI", }; const providerColors: Record = { google: "bg-blue-500", ollama: "bg-green-500", openai: "bg-purple-500", }; export function ProviderBreakdownChart({ data, isLoading }: ProviderBreakdownChartProps) { if (isLoading) { return ( Répartition par Provider Chargement...
{[1, 2, 3, 4].map((i) => (
))}
); } if (!data?.provider_breakdown) { return ( Répartition par Provider Aucune donnée disponible

Aucune donnée de provider

); } const providers = Object.entries(data.provider_breakdown).filter( ([, value]) => value.count > 0 ); return ( Répartition par Provider Distribution des traductions par fournisseur de service
{providers.map(([provider, value]) => (
{providerLabels[provider] || provider} {value.count} ({value.percentage.toFixed(1)}%)
))}
); }