import React, { useState, useMemo, useCallback } from 'react'; import { BarChart, Bar, PieChart, Pie, Cell, ResponsiveContainer, XAxis, YAxis, Tooltip, Legend } from 'recharts'; import { Shield, AlertTriangle, CheckCircle, TrendingUp, Building2, FileText, Clock, DollarSign, Users, Search, Filter, Download, Plus, X, ChevronRight, Lock, Globe, Server, Database } from 'lucide-react'; // Sample vendor data with all 8 risk categories const SAMPLE_VENDORS = [ { id: 'v1', name: 'CloudSecure Inc', category: 'Cloud Infrastructure', tier: 'Critical', riskScore: 92, contractValue: 2500000, employees: 450, founded: 2015, certifications: ['SOC 2 Type II', 'ISO 27001', 'GDPR'], lastAssessment: '2024-11-15', categories: { security: 95, compliance: 90, operational: 88, financial: 92, dataGovernance: 94, exitReadiness: 85, thirdParty: 90, incidentResponse: 96 }, status: 'Active', uptime: 99.95 }, { id: 'v2', name: 'DataFlow Systems', category: 'Data Analytics', tier: 'High', riskScore: 78, contractValue: 850000, employees: 120, founded: 2018, certifications: ['SOC 2 Type I', 'GDPR'], lastAssessment: '2024-10-20', categories: { security: 82, compliance: 85, operational: 75, financial: 70, dataGovernance: 80, exitReadiness: 72, thirdParty: 78, incidentResponse: 80 }, status: 'Active', uptime: 99.5 }, { id: 'v3', name: 'PayStream Solutions', category: 'Payment Processing', tier: 'Critical', riskScore: 88, contractValue: 1800000, employees: 320, founded: 2012, certifications: ['PCI DSS', 'SOC 2 Type II', 'ISO 27001'], lastAssessment: '2024-12-01', categories: { security: 92, compliance: 95, operational: 90, financial: 88, dataGovernance: 85, exitReadiness: 80, thirdParty: 85, incidentResponse: 90 }, status: 'Active', uptime: 99.99 }, { id: 'v4', name: 'HR Connect Pro', category: 'HR Management', tier: 'Medium', riskScore: 65, contractValue: 320000, employees: 85, founded: 2019, certifications: ['SOC 2 Type I'], lastAssessment: '2024-09-10', categories: { security: 68, compliance: 70, operational: 65, financial: 60, dataGovernance: 62, exitReadiness: 58, thirdParty: 65, incidentResponse: 70 }, status: 'Under Review', uptime: 98.5 }, { id: 'v5', name: 'MarketingHub', category: 'Marketing Automation', tier: 'Low', riskScore: 45, contractValue: 120000, employees: 45, founded: 2020, certifications: ['GDPR'], lastAssessment: '2024-08-05', categories: { security: 50, compliance: 55, operational: 48, financial: 40, dataGovernance: 45, exitReadiness: 42, thirdParty: 48, incidentResponse: 45 }, status: 'Active', uptime: 97.8 }, { id: 'v6', name: 'SecureAuth Technologies', category: 'Identity Management', tier: 'High', riskScore: 82, contractValue: 950000, employees: 180, founded: 2016, certifications: ['SOC 2 Type II', 'ISO 27001', 'FedRAMP'], lastAssessment: '2024-11-28', categories: { security: 90, compliance: 88, operational: 82, financial: 78, dataGovernance: 85, exitReadiness: 75, thirdParty: 80, incidentResponse: 88 }, status: 'Active', uptime: 99.8 }, { id: 'v7', name: 'LogiChain Partners', category: 'Supply Chain', tier: 'Medium', riskScore: 58, contractValue: 450000, employees: 200, founded: 2014, certifications: ['ISO 27001'], lastAssessment: '2024-07-15', categories: { security: 60, compliance: 65, operational: 55, financial: 52, dataGovernance: 58, exitReadiness: 50, thirdParty: 55, incidentResponse: 62 }, status: 'Active', uptime: 98.2 }, { id: 'v8', name: 'DevOps Accelerator', category: 'Development Tools', tier: 'Low', riskScore: 42, contractValue: 180000, employees: 60, founded: 2021, certifications: [], lastAssessment: '2024-06-20', categories: { security: 45, compliance: 40, operational: 48, financial: 38, dataGovernance: 42, exitReadiness: 40, thirdParty: 45, incidentResponse: 42 }, status: 'Pending', uptime: 97.0 }, { id: 'v9', name: 'ComplianceFirst', category: 'Regulatory Compliance', tier: 'High', riskScore: 85, contractValue: 720000, employees: 150, founded: 2017, certifications: ['SOC 2 Type II', 'ISO 27001', 'HIPAA', 'GDPR'], lastAssessment: '2024-12-05', categories: { security: 88, compliance: 95, operational: 85, financial: 82, dataGovernance: 90, exitReadiness: 78, thirdParty: 82, incidentResponse: 90 }, status: 'Active', uptime: 99.7 }, { id: 'v10', name: 'BackupVault', category: 'Data Backup', tier: 'Critical', riskScore: 90, contractValue: 1200000, employees: 280, founded: 2013, certifications: ['SOC 2 Type II', 'ISO 27001', 'HIPAA'], lastAssessment: '2024-11-10', categories: { security: 94, compliance: 92, operational: 95, financial: 88, dataGovernance: 90, exitReadiness: 82, thirdParty: 88, incidentResponse: 92 }, status: 'Active', uptime: 99.98 } ]; const RISK_COLORS = { Critical: '#ef4444', High: '#f59e0b', Medium: '#eab308', Low: '#10b981' }; const CATEGORY_ICONS = { security: Shield, compliance: FileText, operational: Clock, financial: DollarSign, dataGovernance: Database, exitReadiness: Globe, thirdParty: Users, incidentResponse: AlertTriangle }; const CATEGORY_LABELS = { security: 'Security Controls', compliance: 'Compliance', operational: 'Operational Resilience', financial: 'Financial Stability', dataGovernance: 'Data Governance', exitReadiness: 'Exit Readiness', thirdParty: 'Third-Party Dependencies', incidentResponse: 'Incident Response' }; export default function App() { const [vendors, setVendors] = useState(SAMPLE_VENDORS); const [selectedVendor, setSelectedVendor] = useState(null); const [searchTerm, setSearchTerm] = useState(''); const [filterTier, setFilterTier] = useState('All'); const [activeTab, setActiveTab] = useState('overview'); const filteredVendors = useMemo(() => { return vendors.filter(v => { const matchesSearch = v.name.toLowerCase().includes(searchTerm.toLowerCase()) || v.category.toLowerCase().includes(searchTerm.toLowerCase()); const matchesTier = filterTier === 'All' || v.tier === filterTier; return matchesSearch && matchesTier; }); }, [vendors, searchTerm, filterTier]); const stats = useMemo(() => { const total = vendors.length; const critical = vendors.filter(v => v.tier === 'Critical').length; const high = vendors.filter(v => v.tier === 'High').length; const avgScore = Math.round(vendors.reduce((sum, v) => sum + v.riskScore, 0) / total); const totalValue = vendors.reduce((sum, v) => sum + v.contractValue, 0); return { total, critical, high, avgScore, totalValue }; }, [vendors]); const riskDistribution = useMemo(() => { const dist = { Critical: 0, High: 0, Medium: 0, Low: 0 }; vendors.forEach(v => dist[v.tier]++); return Object.entries(dist).map(([name, value]) => ({ name, value })); }, [vendors]); const avgCategoryScores = useMemo(() => { const categories = Object.keys(SAMPLE_VENDORS[0].categories); return categories.map(cat => ({ name: CATEGORY_LABELS[cat], score: Math.round(vendors.reduce((sum, v) => sum + v.categories[cat], 0) / vendors.length) })); }, [vendors]); const getRiskColor = useCallback((score) => { if (score >= 80) return '#10b981'; if (score >= 60) return '#eab308'; if (score >= 40) return '#f59e0b'; return '#ef4444'; }, []); const getTierBadgeStyle = useCallback((tier) => { const colors = { Critical: 'bg-red-500/20 text-red-400 border-red-500/30', High: 'bg-amber-500/20 text-amber-400 border-amber-500/30', Medium: 'bg-yellow-500/20 text-yellow-400 border-yellow-500/30', Low: 'bg-emerald-500/20 text-emerald-400 border-emerald-500/30' }; return colors[tier] || colors.Low; }, []); return (
{/* Header */}

Vendor Risk Assessment

Third-party risk management dashboard

{/* Tabs */}
{['overview', 'vendors', 'assessments', 'reports'].map(tab => ( ))}
{activeTab === 'overview' && ( <> {/* KPI Row */}
Total Vendors
{stats.total}
Across all categories
Critical Risk
{stats.critical}
Vendors requiring attention
Avg Risk Score
{stats.avgScore}
Out of 100 (higher is better)
Total Contract Value
${(stats.totalValue / 1000000).toFixed(1)}M
Annual committed spend
{/* Charts Grid */}

Risk Distribution

{riskDistribution.map((entry, index) => ( ))}

Average Scores by Category

)} {/* Vendors Tab */} {(activeTab === 'overview' || activeTab === 'vendors') && (

Vendor Inventory

setSearchTerm(e.target.value)} className="pl-10 pr-4 py-2 bg-white/5 border border-white/10 rounded-lg text-sm focus:outline-none focus:border-blue-500/50 w-full md:w-64" />
{filteredVendors.map(vendor => ( setSelectedVendor(vendor)} className="border-b border-white/5 hover:bg-white/5 cursor-pointer transition" > ))}
Vendor Category Tier Risk Score Contract Value Last Assessment Status
{vendor.name}
{vendor.category} {vendor.tier}
{vendor.riskScore}
${vendor.contractValue.toLocaleString()} {vendor.lastAssessment} {vendor.status}
Showing {filteredVendors.length} of {vendors.length} vendors
)} {/* Detail Modal */} {selectedVendor && (
setSelectedVendor(null)}>
e.stopPropagation()}>

{selectedVendor.name}

{selectedVendor.category}

{/* Quick Stats */}
Risk Score
{selectedVendor.riskScore}/100
Risk Tier
{selectedVendor.tier}
Contract Value
${(selectedVendor.contractValue / 1000000).toFixed(2)}M
Uptime SLA
{selectedVendor.uptime}%
{/* Category Scores */}

Risk Category Breakdown

{Object.entries(selectedVendor.categories).map(([key, score]) => { const Icon = CATEGORY_ICONS[key]; return (
{CATEGORY_LABELS[key]}
{score}/100
); })}
{/* Certifications */}

Certifications & Compliance

{selectedVendor.certifications.length > 0 ? ( selectedVendor.certifications.map(cert => ( {cert} )) ) : ( No certifications on file )}
{/* Company Info */}
Founded
{selectedVendor.founded}
Employees
{selectedVendor.employees}
Last Assessment
{selectedVendor.lastAssessment}
{/* Actions */}
)}
); }