import {Alert, AlertDescription, AlertTitle, Card, CardContent, CardDescription, CardHeader, CardTitle} from '@plunk/ui'; import {AlertCircle, AlertTriangle, CheckCircle, Shield} from 'lucide-react'; import type {ProjectSecurityMetrics, SecurityLevel} from '@plunk/types'; interface SecuritySettingsProps { metrics: ProjectSecurityMetrics; isLoading: boolean; } const STATUS_CONFIG: Record = { healthy: {color: 'text-green-600', icon: CheckCircle, bg: 'bg-green-100', label: 'Healthy'}, warning: {color: 'text-orange-600', icon: AlertTriangle, bg: 'bg-orange-100', label: 'Warning'}, critical: {color: 'text-red-600', icon: AlertCircle, bg: 'bg-red-100', label: 'Critical'}, }; function getOverallLevel(status: ProjectSecurityMetrics['status']): SecurityLevel { if (status.violations.length > 0) return 'critical'; if (status.warnings.length > 0) return 'warning'; return 'healthy'; } export function SecuritySettings({metrics, isLoading}: SecuritySettingsProps) { if (isLoading) { return ( Security Overview Monitor your project's email health and reputation

Loading security metrics...

); } const {status, levels, isDisabled} = metrics; const overallLevel = getOverallLevel(status); const overallConfig = STATUS_CONFIG[overallLevel]; return (
{/* Overall Status Card */}
Security Overview {overallLevel === 'healthy' && 'Your project is in good standing'} {overallLevel === 'warning' && 'Your email health needs attention'} {overallLevel === 'critical' && 'Action required to maintain project health'}
{isDisabled && ( Project Disabled This project has been disabled due to security violations. Contact support to resolve. )} {overallLevel === 'critical' && !isDisabled && ( Critical Your bounce or complaint rates have exceeded acceptable levels. Review your contact lists and sending practices to avoid project suspension. )} {overallLevel === 'warning' && ( Warning Your bounce or complaint rates are approaching limits. Review your contact lists and remove invalid addresses to maintain good standing. )} {overallLevel === 'healthy' && !isDisabled && ( All security metrics are within acceptable levels. Keep up the good work! )}
{/* Bounce Metrics */} Bounce Rate Hard bounces indicate invalid or non-existent email addresses {/* Complaint Metrics */} Complaint Rate Complaints occur when recipients mark emails as spam
); } interface HealthMetricProps { label: string; level: SecurityLevel; detail: string; } function HealthMetric({label, level, detail}: HealthMetricProps) { const config = STATUS_CONFIG[level]; const Icon = config.icon; return (

{label}

{detail}

{config.label}
); }