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 { useScreenCandidate, useScreenOpportunities, useScreenRequirement, useScreenScreen } from './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 = useScreenCandidate(candidateId || null) const requirementQuery = useScreenRequirement(requirementId || null) const opps = useScreenOpportunities(candidateId || null) const screen = useScreenScreen() 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.
) : (