/** * StatisticsCards Component * * Overview statistics cards showing key metrics for the Info Center: * - Total Analysed Pages * - Total Analyzed Pages * - Total Elements * - Coverage Percentage * - Reliability Status Breakdown * - Elements by Type breakdown * * @component * @layer Presentation */ import { Database, FileText, Box, TrendingUp, Activity, CheckCircle } from 'lucide-react'; import type { InfoCenterStats } from '../../presentation/features/info-center/hooks'; import { ElementType } from '@domain/entities'; import { ReliabilityStatus } from '@archer/domain'; import { ELEMENT_TYPE_CONFIG } from '@domain/constants'; import { ReliabilityStatusBadge } from '@/components/ui/ReliabilityStatusBadge'; interface StatisticsCardsProps { stats: InfoCenterStats; } /** * Format date to readable string */ function formatDate(dateStr?: string): string { if (!dateStr) return 'Never'; const date = new Date(dateStr); return date.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' }); } /** * StatisticsCards Component */ export function StatisticsCards({ stats }: StatisticsCardsProps) { // Get top element types (sorted by count) const topElementTypes = Object.entries(stats.elementsByType) .filter(([_, count]) => count > 0) .sort(([, a], [, b]) => b - a) .slice(0, 5); // Calculate reliability statistics const confirmedCount = stats.analysesByReliability[ReliabilityStatus.CONFIRMED] || 0; const pendingCount = stats.analysesByReliability[ReliabilityStatus.PENDING_CONFIRMATION] || 0; const draftCount = stats.analysesByReliability[ReliabilityStatus.DRAFT] || 0; const rejectedCount = stats.analysesByReliability[ReliabilityStatus.REJECTED] || 0; const totalWithReliability = confirmedCount + pendingCount + draftCount + rejectedCount; const confirmationRate = totalWithReliability > 0 ? Math.round((confirmedCount / totalWithReliability) * 100) : 0; return (
Distribution of discovered element types