/* ============================================================ Suggested-role picker — shared by Job Matching and Recruitment Inbox. JobCard is the AI/manual radiogroup row. PickRoleModal is the "choose a different role" search popup. Requirement chips light green when the resume text contains them (client-side substring, same as Matching). ============================================================ */ import { useState } from 'react' import { useQuery } from '@tanstack/react-query' import Modal from './Modal' import { Badge, EmptyState, Icon, ScoreChip } from './primitives' import { friendlyAuthError } from '../lib/errors' import { qk } from '../lib/queryKeys' import * as jobPostsApi from '../api/jobPosts' /** Requirement chip lights green when the resume text contains it (client-side). */ export function reqInResume(req, resumeText) { if (!req || !resumeText) return false const needle = (typeof req === 'string' ? req : (req?.name || req?.label || '')).trim().toLowerCase() if (!needle) return false return resumeText.toLowerCase().includes(needle) } function reqLabel(req) { if (req == null) return '' if (typeof req === 'string' || typeof req === 'number') return String(req) if (typeof req === 'object') return String(req.name || req.label || req.skill || '') return String(req) } export function JobCard({ post, rank, selected, onSelect, resumeText, manual, badge }) { const unavailable = Boolean(post?.unavailable) || !post?.title const title = post?.title || 'Unavailable' const meta = [ post?.employment_type, post?.location, post?.experience_min != null || post?.experience_max != null ? `${post?.experience_min ?? '?'}–${post?.experience_max ?? '?'} yrs` : null, ].filter(Boolean).join(' · ') const tag = badge ?? (manual ? 'Manual' : `AI #${rank}`) return (