import React from 'react'; import { Shield, ShieldCheck, AlertTriangle, XCircle, RefreshCw, CheckCircle, Clock, Activity, Eye, Info } from 'lucide-react'; import { SecurityStatusCardProps } from '@/types/security'; const SecurityStatusCard: React.FC = ({ status, onRefresh, loading = false, }) => { const getStatusIcon = () => { switch (status.overall) { case 'healthy': return ; case 'warning': return ; case 'critical': return ; default: return ; } }; const getStatusColor = () => { switch (status.overall) { case 'healthy': return 'bg-green-50 border-green-200 text-green-900'; case 'warning': return 'bg-yellow-50 border-yellow-200 text-yellow-900'; case 'critical': return 'bg-red-50 border-red-200 text-red-900'; default: return 'bg-gray-50 border-gray-200 text-gray-900'; } }; const getStatusText = () => { switch (status.overall) { case 'healthy': return 'All security features are operating normally'; case 'warning': return 'Some security features require attention'; case 'critical': return 'Critical security issues detected'; default: return 'Security status unknown'; } }; const formatLastUpdate = (timestamp: string) => { const date = new Date(timestamp); const now = new Date(); const diff = now.getTime() - date.getTime(); const minutes = Math.floor(diff / 60000); if (minutes < 1) return 'Just now'; if (minutes < 60) return `${minutes} minute${minutes !== 1 ? 's' : ''} ago`; if (minutes < 1440) return `${Math.floor(minutes / 60)} hour${Math.floor(minutes / 60) !== 1 ? 's' : ''} ago`; return date.toLocaleDateString(); }; return (
{/* Main Status Card */}
{getStatusIcon()}

Security Overview

{getStatusText()}

{/* Feature Status Grid */}
{status.features.map((feature) => (
{feature.name} {feature.enabled ? (
{feature.status === 'healthy' ? 'Active' : feature.status}
) : (
Disabled
)}
{feature.details && (

{feature.details}

)}

{formatLastUpdate(feature.last_check)}

))}
{/* Recent Events Summary */}

Recent Events

{status.recent_events}

Last 24 hours

Enabled Features

{status.features.filter(f => f.enabled).length}/{status.features.length}

Active

Last Updated

{formatLastUpdate(status.last_updated)}

{/* Alert Section */} {status.overall !== 'healthy' && (
{status.overall === 'warning' ? ( ) : ( )}

{status.overall === 'warning' ? 'Security Warnings' : 'Security Alert'}

    {status.features .filter(f => f.status !== 'healthy' && f.enabled) .map((feature, index) => (
  • {feature.name}: {feature.details || feature.status}
  • ))}
)} {/* Quick Actions */}

Quick Actions

); }; export default SecurityStatusCard;