/** * Domain Validation Modal * * CRITICAL UI COMPONENT for resume-first architecture. * * This modal: * 1. Shows when user-selected domain doesn't match resume domain * 2. BLOCKS interview flow until user confirms or switches domain * 3. Shows clear warning with confidence scores * 4. Provides options to switch domain or continue anyway */ import React from 'react'; import { AlertTriangle, CheckCircle, XCircle, ArrowRight, RefreshCw, Shield, Code, Cpu, Zap, Building2, Palette, Cog } from 'lucide-react'; // Domain icon mapping const DOMAIN_ICONS = { computer_science: Code, electronics: Cpu, electrical: Zap, mechanical: Cog, civil: Building2, architecture: Palette, }; // Domain color mapping const DOMAIN_COLORS = { computer_science: '#8b5cf6', electronics: '#06b6d4', electrical: '#f59e0b', mechanical: '#ef4444', civil: '#10b981', architecture: '#ec4899', }; function DomainValidationModal({ validationResult, selectedBranch, selectedRole, onSwitchDomain, onContinueAnyway, onClose, isLoading = false, }) { if (!validationResult) return null; const { is_match, warning_level, message, recommendation, can_proceed, requires_confirmation, resume_domain, resume_domain_name, resume_confidence, allowed_rounds, // NEW: Role-level mismatch fields mismatch_type, resume_specialization, resume_specialization_name, selected_role_specialization, selected_role_specialization_name, resume_skills, match_confidence, } = validationResult; // Check if this is a role-level mismatch (within CS domain) const isRoleMismatch = mismatch_type === 'role'; // Get icons for domains const ResumeDomainIcon = DOMAIN_ICONS[resume_domain] || Code; const SelectedDomainIcon = DOMAIN_ICONS[selectedBranch] || Code; const resumeDomainColor = DOMAIN_COLORS[resume_domain] || '#8b5cf6'; const selectedDomainColor = DOMAIN_COLORS[selectedBranch] || '#8b5cf6'; // Determine modal severity const isHardWarning = warning_level === 'hard'; const isSoftWarning = warning_level === 'soft'; // Modal style based on severity const severityStyles = { hard: { borderColor: '#ef4444', iconBg: 'rgba(239, 68, 68, 0.1)', iconColor: '#ef4444', }, soft: { borderColor: '#f59e0b', iconBg: 'rgba(245, 158, 11, 0.1)', iconColor: '#f59e0b', }, none: { borderColor: '#10b981', iconBg: 'rgba(16, 185, 129, 0.1)', iconColor: '#10b981', }, }; const styles = severityStyles[warning_level] || severityStyles.none; // If it's a match, don't show modal (auto-proceed) if (is_match && can_proceed && !requires_confirmation) { return null; } return (
{message}
Both roles are in Computer Science, but they require different skill sets.
Interview questions will be tailored to your selected role.