import React from 'react'; import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog'; import { Mail, Phone, Briefcase, Star, Award, BadgeCheck, Fingerprint, X, Calendar, UserCheck, Sparkles, Brain, MessageSquare } from 'lucide-react'; import { Image } from '@/components/ui/image'; import CareerScoreGauge from '@/components/krow/talent/CareerScoreGauge'; import ExperienceEndorsements, { verifiedExperience } from '@/components/krow/talent/ExperienceEndorsements'; import EliteTalentScore from '@/components/krow/talent/EliteTalentScore'; const PORTRAIT_PHOTOS = [ 'photo-1500648767731-7d3514ad8b31', 'photo-1531123897727-8f129e1688ce', 'photo-1573496359142-b8d87734a5a2', 'photo-1487412720507-e7ab37603c6f', 'photo-1502685104226-ee3a97a2f2c8', 'photo-1544005313-94ddf0286df2', 'photo-1494790108377-be9c29b29330', 'photo-1438761681033-6461ffad8d80', 'photo-1517841905240-472988babdf9', 'photo-1463453091185-61582044d556', ]; function getPortraitSeed(name) { let h = 0; for (let i = 0; i < (name || '').length; i++) h = (h * 31 + name.charCodeAt(i)) >>> 0; return PORTRAIT_PHOTOS[h % PORTRAIT_PHOTOS.length]; } function getInitials(name) { return (name || '').split(' ').map(w => w[0]).slice(0, 2).join('').toUpperCase() || '??'; } function getKrowIdCode(profile) { if (profile?.id) { const hex = profile.id.replace(/[^a-f0-9]/gi, ''); if (hex.length >= 6) return hex.slice(0, 6).toUpperCase(); } let h = 0; const seed = profile?.full_name || 'KROW'; for (let i = 0; i < seed.length; i++) h = (h * 31 + seed.charCodeAt(i)) >>> 0; return (h & 0xFFFFFF).toString(16).padStart(6, '0').toUpperCase(); } function formatDate(d) { try { return new Date(d).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' }); } catch { return ''; } } const BADGE_LEVEL_STYLES = { bronze: 'bg-[#FEF3C7] text-[#92400E] border-[#FCD34D]', silver: 'bg-[#F3F4F6] text-[#4B5563] border-[#D1D5DB]', gold: 'bg-[#FEF9E7] text-[#92400E] border-[#F9E547]', platinum: 'bg-[#EEF3FE] text-[#1E40AF] border-[#BFDBFE]', }; function Section({ label, children }) { if (!children) return null; return (

{label}

{children}
); } function PillList({ items, className = 'bg-[#F0F4F8] text-[#0047AB]' }) { if (!items || items.length === 0) return null; return (
{items.map((it, i) => ( {it} ))}
); } function ScoreFactor({ label, value }) { return (
{label} {value}
); } /** @param {any} props */ export default function TalentDetailModal({ open, onClose, profile, onContact, onSchedule, onHire, matchScore, matchReasons }) { if (!profile) return null; const badges = profile.earned_badges || []; const capabilities = (profile.capabilities || []).filter((c) => c.status === 'verified' || c.status === 'pending'); const experience = profile.experience || []; const strengths = profile.strengths || []; const verifiedExperienceList = verifiedExperience(profile).length > 0; const krowCode = getKrowIdCode(profile); const reportDate = formatDate(profile.updated_date || new Date()); const openToWork = profile.status === 'active' && (profile.availability?.length > 0 || !profile.current_position); const reliability = Math.round(profile.reliability_score || 0); const attendance = Math.round(profile.attendance_score || 0); const performance = Math.round(profile.performance_score || 0); const leadership = Math.round(profile.leadership_potential || 0); const aiInterview = Math.round(profile.ai_interview_score || 0); const xp = Math.round(profile.xp || 0); const identityVerified = capabilities.length > 0 || badges.length > 0; const identityTag = identityVerified ? 'Verified' : 'Pending'; const identityClass = identityVerified ? 'bg-[#EEF3FE] text-[#1E40AF]' : 'bg-[#FFF7ED] text-[#B45309]'; return ( !o && onClose()}> {profile.full_name} — KROW Identity {/* KROW ID header — clean white, no blue band */}
{profile.selfie_url ? ( {profile.full_name} ) : ( {getInitials(profile.full_name)} )}
KROW ID · {krowCode}

{profile.full_name}

{identityVerified && ( {identityTag} )} {openToWork && ( · Open to work )}

Career Report · {reportDate}

{/* Quick stats banner — pill capsules, single line */}
{profile.experience_years > 0 && ( } label="Experience" value={`${profile.experience_years} yr`} /> )} {profile.shifts_completed > 0 && ( } label="Shifts" value={profile.shifts_completed} /> )} {(profile.client_rating > 0 || profile.supervisor_rating > 0) && ( } label="Rating" value={`${((profile.client_rating + profile.supervisor_rating) / 2).toFixed(1)}`} valueClass="text-[#F59E0B]" /> )} {profile.desired_position && ( } label="Role" value={profile.desired_position} /> )}
{/* Match banner */} {matchScore != null && (
Match Score: {matchScore}/100
{matchReasons?.length > 0 && (
    {matchReasons.map((r, i) =>
  • {r}
  • )}
)}
)} {/* Career Score */}
{/* Elite Talent scorecard — dotted-leader metric list */}
{/* Badges */} {badges.length > 0 && (
{badges.map((b, i) => ( {b.name} {b.level && · {b.level}} ))}
)} {/* Endorsements / Verified Capabilities */} {capabilities.length > 0 && (
{capabilities.map((c, i) => ( {c.skill} {c.level && · {c.level}} ))}
)} {/* Consolidated Experience & Endorsements — jobs + client endorsements in one list */} {verifiedExperience(profile).length > 0 && (
)} {/* Personality + strengths */} {(profile.personality || strengths.length > 0 || profile.communication_style) && (
{profile.personality && (

PERSONALITY

{profile.personality}

)} {profile.communication_style && (

COMMUNICATION STYLE

{profile.communication_style}

)}
{strengths.length > 0 && (

STRENGTHS

)}
)} {/* Contact info + actions */}
{profile.email && {profile.email}} {profile.phone && {profile.phone}}
{onContact && ( )} {onSchedule && ( )} {onHire && ( )}
); } function Stat({ label, value, icon, valueClass = 'text-[#5D759B]' }) { return ( {icon} {label} · {value} ); }