feat(signals): add Unrelated and Digest reclassify chips to InterviewCard
This commit is contained in:
parent
d10093cfa0
commit
9d03cb55a9
1 changed files with 11 additions and 8 deletions
|
|
@ -63,31 +63,34 @@ function toggleBodyExpand(sigId: number) {
|
|||
expandedSignalIds.value = next
|
||||
}
|
||||
|
||||
// Re-classify chips — neutral triggers two-call dismiss path
|
||||
// Re-classify chips — neutral/unrelated/digest trigger two-call dismiss path
|
||||
const RECLASSIFY_CHIPS = [
|
||||
{ label: '🟡 Interview', value: 'interview_scheduled' as const },
|
||||
{ label: '✅ Positive', value: 'positive_response' as const },
|
||||
{ label: '🟢 Offer', value: 'offer_received' as const },
|
||||
{ label: '📋 Survey', value: 'survey_received' as const },
|
||||
{ label: '✖ Rejected', value: 'rejected' as const },
|
||||
{ label: '🚫 Unrelated', value: 'unrelated' },
|
||||
{ label: '📰 Digest', value: 'digest' },
|
||||
{ label: '— Neutral', value: 'neutral' },
|
||||
] as const
|
||||
|
||||
async function reclassifySignal(sig: StageSignal, newLabel: StageSignal['stage_signal'] | 'neutral') {
|
||||
if (newLabel === 'neutral') {
|
||||
// Optimistic removal — neutral signals are dismissed
|
||||
const DISMISS_LABELS = new Set(['neutral', 'unrelated', 'digest'] as const)
|
||||
|
||||
async function reclassifySignal(sig: StageSignal, newLabel: StageSignal['stage_signal'] | 'neutral' | 'unrelated' | 'digest') {
|
||||
if (DISMISS_LABELS.has(newLabel)) {
|
||||
// Optimistic removal
|
||||
const arr = props.job.stage_signals
|
||||
const idx = arr.findIndex(s => s.id === sig.id)
|
||||
if (idx !== -1) arr.splice(idx, 1)
|
||||
// Two-call path: persist corrected label then dismiss (Avocet training hook)
|
||||
// Two-call path: persist label (Avocet training hook) then dismiss
|
||||
await useApiFetch(`/api/stage-signals/${sig.id}/reclassify`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ stage_signal: 'neutral' }),
|
||||
body: JSON.stringify({ stage_signal: newLabel }),
|
||||
})
|
||||
await useApiFetch(`/api/stage-signals/${sig.id}/dismiss`, { method: 'POST' })
|
||||
} else {
|
||||
// Optimistic local re-label — Vue 3 proxy tracks the mutation
|
||||
const prev = sig.stage_signal
|
||||
sig.stage_signal = newLabel
|
||||
const { error } = await useApiFetch(`/api/stage-signals/${sig.id}/reclassify`, {
|
||||
|
|
|
|||
Loading…
Reference in a new issue