import React from 'react'; import { Link } from 'react-router-dom'; import { ExternalLink, Github } from 'lucide-react'; import { Advisory } from '../types'; import { AdvisoryPlatformBadge } from './AdvisoryPlatformBadge'; interface AdvisoryCardProps { advisory: Advisory; formatDate: (dateStr: string) => string; } export const AdvisoryCard: React.FC = ({ advisory, formatDate }) => { const getSeverityClasses = (severity: string) => { switch (severity) { case 'critical': return 'bg-red-500/20 text-red-400'; case 'high': return 'bg-orange-500/20 text-orange-400'; case 'medium': return 'bg-yellow-500/20 text-yellow-400'; default: return 'bg-blue-500/20 text-blue-400'; } }; const getTypeLabel = (type: string) => { switch (type) { case 'malicious_skill': return 'Malicious Skill'; case 'vulnerable_skill': return 'Vulnerable Skill'; case 'prompt_injection': return 'Prompt Injection'; case 'attack_pattern': return 'Attack Pattern'; case 'best_practice': return 'Best Practice'; case 'tampering_attempt': return 'Tampering Attempt'; default: return type; } }; // Determine if this is a community report (has github_issue_url) or NVD/staff advisory const isCommunityReport = !!advisory.github_issue_url; return (
{advisory.severity} {advisory.cvss_score && ({advisory.cvss_score})} {getTypeLabel(advisory.type)}
{formatDate(advisory.published)}

{advisory.id}

{advisory.title}

{advisory.platforms && advisory.platforms.length > 0 && (
{advisory.platforms.map((platform) => ( ))}
)} {/* External link - stop propagation to allow clicking without navigating to detail */} {isCommunityReport && advisory.github_issue_url ? ( { e.preventDefault(); e.stopPropagation(); window.open(advisory.github_issue_url, '_blank', 'noopener,noreferrer'); }} className="inline-flex items-center gap-1 text-xs text-clawd-accent hover:underline cursor-pointer" > View GitHub Report ) : advisory.nvd_url ? ( { e.preventDefault(); e.stopPropagation(); window.open(advisory.nvd_url, '_blank', 'noopener,noreferrer'); }} className="inline-flex items-center gap-1 text-xs text-clawd-accent hover:underline cursor-pointer" > View on NVD ) : null} ); };