/* ═══════════════════════════════════════════════════════════════ FindingCard — Expandable finding card with severity + code ═══════════════════════════════════════════════════════════════ */ import { useState } from 'react'; import SeverityBadge from './SeverityBadge'; import './FindingCard.css'; const AGENT_ICONS = { security: '🔍', performance: '⚡', fix: '🔧', }; export default function FindingCard({ finding, index, fix }) { const [isExpanded, setIsExpanded] = useState(false); return (
setIsExpanded(!isExpanded)} >
{AGENT_ICONS[finding.agent] || '🔍'}
{finding.cwe && {finding.cwe}}

{finding.title}

{finding.id && {finding.id}}

{finding.description}

{finding.file && (
📄 {finding.file} {finding.line && :{finding.line}}
)} {/* Expanded Details */} {isExpanded && (
{/* Code Snippet */} {finding.code && (
Vulnerable Code
{finding.code}
)} {/* Suggestion */} {finding.suggestion && (
💡 Recommendation

{finding.suggestion}

)} {/* Fix Preview */} {fix && (
🔧 AI-Generated Fix
Before
{fix.before}
After
{fix.after}
{fix.explanation && (

{fix.explanation}

)}
)}
)} {/* Quick action bar */}
{finding.fixAvailable && !fix && ( 🔧 Fix available )} {fix && ( Fix generated )}
); }