import { useState } from 'react' import { CheckCircle2, Loader2, PauseCircle, XCircle } from 'lucide-react' import { useRecordOutcome } from '../tools/screenmatch/queries' // One click screening outcome capture: Advance, Hold, or Reject with a reason code. Every action // posts one outcome event, the feedback signal the platform learns from. Zero friction: pick a // reason, click once, done. const REASONS: Record = { advance: [ { code: 'strong_skills_match', label: 'Strong skills match' }, { code: 'clearance_fit', label: 'Clearance fits the role' }, { code: 'customer_experience', label: 'Prior customer experience' }, { code: 'overall_fit', label: 'Strong overall fit' }, ], hold: [ { code: 'pending_clearance', label: 'Pending clearance action' }, { code: 'awaiting_availability', label: 'Awaiting availability' }, { code: 'needs_review', label: 'Needs a second review' }, { code: 'backup_candidate', label: 'Hold as a backup' }, ], reject: [ { code: 'skills_gap', label: 'Skills gap' }, { code: 'clearance_gap', label: 'Clearance gap' }, { code: 'experience_gap', label: 'Experience gap' }, { code: 'location_unavailable', label: 'Location or availability' }, ], } const SIGNALS: Record = { advance: 1, hold: 0, reject: -1 } export function OutcomeBar({ candidateId, requirementId }: { candidateId: string; requirementId: string }) { const record = useRecordOutcome() const [decided, setDecided] = useState(null) const [pendingAction, setPendingAction] = useState(null) const [reason, setReason] = useState('') const submit = (action: string, reasonCode: string) => { record.mutate( { module: 'screen', subjectType: 'candidate', subjectId: candidateId, requirementId, eventType: 'screening_decision', signalValue: SIGNALS[action], reasonCode, }, { onSuccess: () => setDecided(action) }, ) setPendingAction(null) setReason('') } if (decided) { const labels: Record = { advance: 'Advanced. The decision was recorded and feeds future recommendations.', hold: 'Placed on hold. The decision was recorded.', reject: 'Rejected. The decision was recorded and feeds future recommendations.', } return (
{labels[decided]}
) } if (pendingAction) { return (
{pendingAction}: {record.isError && Could not record the decision. Try again.}
) } return (
Screening decision A person decides. The decision is recorded, never automated.
) }