import { useEffect, 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 { useCandidate, useOpportunities, useRequirement, useScreen } from '../lib/queries' import { Badge, Bar, Panel } from '../components/ui' 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 = useCandidate(candidateId || null) const requirementQuery = useRequirement(requirementId || null) const opps = useOpportunities(candidateId || null) const screen = useScreen() useEffect(() => { // Clear the prior result first so a stale screen.data never renders under the new candidate's // identity during the transition; only the loading state shows until the new score returns. screen.reset() if (candidateId && requirementId) screen.mutate({ candidateId, requirementId }) // eslint-disable-next-line react-hooks/exhaustive-deps }, [candidateId, requirementId]) const candidate = candidateQuery.data const requirement = requirementQuery.data return (
{(screen.error as Error).message}
Scoring opportunities…
) : !opps.data?.length ? (No matching opportunities.
) : (