"use client"; type RuleExplanationProps = { explanation?: string; examples?: string[]; missingPatterns?: string[]; edgeCases?: string[]; improvements?: string[]; severity?: string; }; export function RuleExplanation({ explanation, examples = [], missingPatterns = [], edgeCases = [], improvements = [], severity, }: RuleExplanationProps) { if (!explanation && examples.length === 0 && missingPatterns.length === 0) { return null; } const severityColors = { low: "bg-blue-500/20 border-blue-500/50 text-blue-200", medium: "bg-yellow-500/20 border-yellow-500/50 text-yellow-200", high: "bg-orange-500/20 border-orange-500/50 text-orange-200", critical: "bg-red-500/20 border-red-500/50 text-red-200", }; const severityColor = severityColors[severity as keyof typeof severityColors] || severityColors.medium; return (
{/* Explanation */} {explanation && (

💡 Explanation

{explanation}

)} {/* Examples */} {examples.length > 0 && (

📋 Examples This Rule Would Catch

{examples.map((example, idx) => (
"{example}"
))}
)} {/* Missing Patterns */} {missingPatterns.length > 0 && (

🔍 Suggested Missing Patterns

{missingPatterns.map((pattern, idx) => (
{pattern}
))}
)} {/* Edge Cases */} {edgeCases.length > 0 && (

⚠️ Edge Cases Identified

)} {/* Improvements */} {improvements.length > 0 && (

Improvements Applied

)} {/* Severity Badge */} {severity && (
🛡️ Severity: {severity}
)}
); }