import React, { useState } from 'react'; import { CheckCircle, XCircle, AlertCircle } from 'lucide-react'; import { useToast } from '../contexts/ToastContext'; const API_BASE = process.env.REACT_APP_API_BASE || 'http://localhost:3001/api'; const cardStyle = { background: 'linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(51, 65, 85, 0.9) 50%, rgba(30, 41, 59, 0.95) 100%)', border: '2px solid rgba(14, 165, 233, 0.4)', borderRadius: '0.5rem', boxShadow: '0 8px 24px rgba(0, 0, 0, 0.6), 0 0 28px rgba(14, 165, 233, 0.15), inset 0 1px 0 rgba(14, 165, 233, 0.12)', position: 'relative', overflow: 'hidden', padding: '1.5rem', }; export default function QuickCVELookup() { const [query, setQuery] = useState(''); const [result, setResult] = useState(null); const [loading, setLoading] = useState(false); const toast = useToast(); const handleLookup = async () => { const trimmed = query.trim(); if (!trimmed) return; setLoading(true); try { const response = await fetch(`${API_BASE}/cves/check/${encodeURIComponent(trimmed)}`, { credentials: 'include' }); if (!response.ok) throw new Error('Failed to check CVE'); const data = await response.json(); setResult(data); } catch (err) { toast.error(err.message); setResult({ error: err.message }); } finally { setLoading(false); } }; return (
Error
{result.error}
✓ CVE Addressed ({result.vendors.length} vendor{result.vendors.length > 1 ? 's' : ''})
{vendorInfo.vendor}
Severity: {vendorInfo.severity}
Status: {vendorInfo.status}
Documents: {vendorInfo.total_documents} attached
Not Found
This CVE has not been addressed yet. No entry exists in the database.