// frontend/src/components/alerts/AlertStats.tsx /** * Statistics display for alerts and recommendations */ import React from 'react'; interface AlertStatsProps { urgentCount: number; highCount: number; recCount: number; totalItems: number; activeItems: number; } export const AlertStats: React.FC = ({ urgentCount, highCount, recCount, totalItems, activeItems }) => { const stats = [ { name: 'Alertas Urgentes', value: urgentCount, icon: '🚨', color: urgentCount > 0 ? 'text-red-600' : 'text-gray-600', bgColor: urgentCount > 0 ? 'bg-red-50' : 'bg-gray-50', borderColor: urgentCount > 0 ? 'border-red-200' : 'border-gray-200' }, { name: 'Alertas Altas', value: highCount, icon: '⚠️', color: highCount > 0 ? 'text-orange-600' : 'text-gray-600', bgColor: highCount > 0 ? 'bg-orange-50' : 'bg-gray-50', borderColor: highCount > 0 ? 'border-orange-200' : 'border-gray-200' }, { name: 'Recomendaciones', value: recCount, icon: '💡', color: recCount > 0 ? 'text-blue-600' : 'text-gray-600', bgColor: recCount > 0 ? 'bg-blue-50' : 'bg-gray-50', borderColor: recCount > 0 ? 'border-blue-200' : 'border-gray-200' }, { name: 'Total Activos', value: activeItems, icon: '📊', color: 'text-gray-600', bgColor: 'bg-gray-50', borderColor: 'border-gray-200' } ]; return (
{stats.map((stat) => (
{stat.icon} {stat.name}
{stat.value}
{/* Pulse animation for urgent alerts */} {stat.name === 'Alertas Urgentes' && urgentCount > 0 && (
)}
))}
{/* Summary text */}
{totalItems === 0 ? (

Todos los sistemas funcionan correctamente

) : (

Mostrando {totalItems} elementos total{totalItems !== 1 ? 'es' : ''} {activeItems > 0 && ( <>, {activeItems} activo{activeItems !== 1 ? 's' : ''} )}

)}
); };