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