import { type ReactNode } from 'react' import { Link, useParams } from 'react-router-dom' import { ArrowLeft, CheckCircle2, Clock, Compass, FileDown, Layers, Loader2, MapPin, Share2, ShieldCheck, } from 'lucide-react' import { useScreenCandidate, useScreenOpportunities, useScreenRequirement, useScreenScreen } from './queries' import { Badge, Bar, Panel } from '../../components/ui' import { OutcomeBar } from '../../components/OutcomeBar' import { ScreeningResults } from '../../components/ScreeningResults' import { WorkforceDNA } from '../../components/WorkforceDNA' import { bandColor, clearanceLabel, num, statusLabel } from '../../lib/format' import type { Band } from '../../lib/types' function proposal(band: Band) { if (band === 'green') return { label: 'PROPOSAL READY', color: 'var(--color-ok)' } if (band === 'yellow') return { label: 'REVIEW REQUIRED', color: 'var(--color-warn)' } return { label: 'RECRUITING REQUIRED', color: 'var(--color-risk)' } } export function CandidateEvaluation() { const { candidateId = '', requirementId = '' } = useParams() const candidateQuery = useScreenCandidate(candidateId || null) const requirementQuery = useScreenRequirement(requirementId || null) const opps = useScreenOpportunities(candidateId || null) // Scoring this pair is a read, so it is a keyed query rather than a mutation fired from an effect. // The key carries the pair, which is what guarantees a stale score can never render under the new // candidate's identity during a transition: a different pair is a different cache slot. const screen = useScreenScreen(candidateId || null, requirementId || null) const candidate = candidateQuery.data const requirement = requirementQuery.data return (
Back to Screening Queue {screen.isLoading && ( Evaluating mission readiness… )} {screen.isError && (

{(screen.error as Error).message}

)} {screen.data && candidate && requirement && ( <> {/* SCREEN 2, Candidate Intelligence Profile + Workforce DNA */}
{candidate.full_name .split(' ') .map((p) => p[0]) .slice(0, 2) .join('')}

{candidate.full_name}

{requirement.title}
} k="Clearance (self reported)" v={`${clearanceLabel[candidate.clearance_level] ?? candidate.clearance_level} · ${statusLabel[candidate.clearance_status] ?? candidate.clearance_status} · not verified`} /> } k="Experience" v={`${candidate.years_experience} years`} /> {candidate.location && } k="Location" v={candidate.location} />} } k="Availability" v={candidate.available ? 'Available Now' : 'Engaged'} />
Workforce DNA™
{/* The one click screening decision, the closed loop feedback capture */} {/* SCREENS 3-5, full screening intelligence (header suppressed) */} {/* SCREEN 5/6, Best Fit Programs + Proposal Readiness */}
{opps.isLoading ? (

Scoring opportunities…

) : !opps.data?.length ? (

No matching opportunities.

) : (
{opps.data.map((o) => (
{o.title} {num(o.score).toFixed(0)}%
))}
)}
{(() => { const pr = proposal(screen.data.mission_readiness.band) const roles = (opps.data ?? []).filter((o) => o.band === 'green') return (
{pr.label}
Proposal strength {num(screen.data.mission_readiness.score).toFixed(0)}%
Can Fill These Roles
{requirement.title} {roles .filter((r) => r.requirement_id !== requirement.id) .map((r) => ( {r.title} ))}
) })()}
)}
) } function Fact({ icon, k, v }: { icon: ReactNode; k: string; v: string }) { return (
{icon} {k}
{v}
) }