sponsor match is binary
This commit is contained in:
parent
1fd6a4b4c2
commit
30385cfe24
@ -103,31 +103,15 @@ const SponsorBadge: React.FC<SponsorBadgeProps> = ({ score, names, onCheck }) =>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no score (and no callback), show nothing
|
// If no score (and no callback), or error in score, show nothing
|
||||||
if (score == null || score < 50) {
|
if (score == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Color tokens based on score
|
const isFound = score >= 95;
|
||||||
const getScoreTokens = (s: number) => {
|
const tooltipContent = isFound
|
||||||
if (s >= 90) return {
|
? `Confirmed Visa Sponsor (${score}% match: ${parsedNames.join(", ")})`
|
||||||
badge: "border-emerald-500/40 bg-emerald-500/15 text-emerald-300",
|
: `Sponsor Not Found (${score}% match${parsedNames.length > 0 ? `: ${parsedNames.join(", ")}` : ""})`;
|
||||||
label: "Visa Sponsor"
|
|
||||||
};
|
|
||||||
if (s >= 70) return {
|
|
||||||
badge: "border-amber-500/40 bg-amber-500/15 text-amber-300",
|
|
||||||
label: "Likely Sponsor"
|
|
||||||
};
|
|
||||||
return {
|
|
||||||
badge: "border-orange-500/40 bg-orange-500/15 text-orange-300",
|
|
||||||
label: "Possible Sponsor"
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const tokens = getScoreTokens(score);
|
|
||||||
const tooltipContent = parsedNames.length > 0
|
|
||||||
? `${score}% match: ${parsedNames.join(", ")}`
|
|
||||||
: `${score}% match with visa sponsor list`;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
@ -135,16 +119,18 @@ const SponsorBadge: React.FC<SponsorBadgeProps> = ({ score, names, onCheck }) =>
|
|||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<span
|
<span
|
||||||
className={cn(
|
className={cn(
|
||||||
"inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wide cursor-help",
|
"inline-flex items-center gap-1 rounded-full border px-1 py-1 text-[9px] font-semibold uppercase tracking-wide cursor-help transition-colors",
|
||||||
tokens.badge
|
isFound
|
||||||
|
? "border-emerald-500/40 bg-emerald-500/15 text-emerald-400"
|
||||||
|
: "border-slate-500/40 bg-slate-500/15 text-slate-400"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<Shield className="h-2.5 w-2.5" />
|
<Shield className={cn("h-3 w-3", isFound ? "fill-emerald-400/20" : "")} />
|
||||||
{score}%
|
|
||||||
</span>
|
</span>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent side="top" className="max-w-xs">
|
<TooltipContent side="top" className="max-w-xs">
|
||||||
<p className="text-xs">{tooltipContent}</p>
|
<p className="text-xs font-medium">{isFound ? "Found" : "Not Found"}</p>
|
||||||
|
<p className="text-[10px] opacity-80 mt-1">{tooltipContent}</p>
|
||||||
</TooltipContent>
|
</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
|
|||||||
@ -31,6 +31,9 @@ vi.mock("../../components", () => ({
|
|||||||
DiscoveredPanel: ({ job }: { job: Job | null }) => (
|
DiscoveredPanel: ({ job }: { job: Job | null }) => (
|
||||||
<div data-testid="discovered-panel">{job?.id ?? "no-job"}</div>
|
<div data-testid="discovered-panel">{job?.id ?? "no-job"}</div>
|
||||||
),
|
),
|
||||||
|
JobHeader: () => <div data-testid="job-header" />,
|
||||||
|
FitAssessment: () => <div data-testid="fit-assessment" />,
|
||||||
|
TailoredSummary: () => <div data-testid="tailored-summary" />,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
vi.mock("../../components/ReadyPanel", () => ({
|
vi.mock("../../components/ReadyPanel", () => ({
|
||||||
|
|||||||
@ -160,7 +160,7 @@ jobsRouter.post('/:id/check-sponsor', async (req: Request, res: Response) => {
|
|||||||
minScore: 50,
|
minScore: 50,
|
||||||
});
|
});
|
||||||
|
|
||||||
let sponsorMatchScore: number | null = null;
|
let sponsorMatchScore = 0;
|
||||||
let sponsorMatchNames: string | null = null;
|
let sponsorMatchNames: string | null = null;
|
||||||
|
|
||||||
if (sponsorResults.length > 0) {
|
if (sponsorResults.length > 0) {
|
||||||
@ -177,7 +177,7 @@ jobsRouter.post('/:id/check-sponsor', async (req: Request, res: Response) => {
|
|||||||
|
|
||||||
// Update job with sponsor match info
|
// Update job with sponsor match info
|
||||||
const updatedJob = await jobsRepo.updateJob(job.id, {
|
const updatedJob = await jobsRepo.updateJob(job.id, {
|
||||||
sponsorMatchScore: sponsorMatchScore ?? undefined,
|
sponsorMatchScore: sponsorMatchScore,
|
||||||
sponsorMatchNames: sponsorMatchNames ?? undefined,
|
sponsorMatchNames: sponsorMatchNames ?? undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -295,7 +295,7 @@ export async function runPipeline(config: Partial<PipelineConfig> = {}): Promise
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Calculate sponsor match score using fuzzy search
|
// Calculate sponsor match score using fuzzy search
|
||||||
let sponsorMatchScore: number | undefined;
|
let sponsorMatchScore = 0;
|
||||||
let sponsorMatchNames: string | undefined;
|
let sponsorMatchNames: string | undefined;
|
||||||
|
|
||||||
if (job.employer) {
|
if (job.employer) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user