feat(matches): add the candidate match screen with expandable explanations
This commit is contained in:
1 parent
0b11021b16
commit
28337d84cb
50 files changed
+4834
-37
No files matched your search
@@ -0,0 +1,94 @@
|
||||
import type {
|
||||
AnonymousCardContent,
|
||||
EvidenceSkillCode,
|
||||
OrganizationEvidence,
|
||||
} from "../../../shared/api/schemas";
|
||||
import type { TrustLevelValue } from "../../../shared/ui";
|
||||
import {
|
||||
experienceBandLabels,
|
||||
gradeLabels,
|
||||
salaryCompatibilityLabels,
|
||||
specializationLabels,
|
||||
stackLabels,
|
||||
strengthLabels,
|
||||
workFormatLabels,
|
||||
} from "./labels";
|
||||
|
||||
export type CardDetails = {
|
||||
categories: readonly { specialization: string; grade: string; strength: string }[] | null;
|
||||
selfAssessments:
|
||||
| readonly {
|
||||
specialization: string;
|
||||
declaredGrade: string | null;
|
||||
confirmed: boolean;
|
||||
}[]
|
||||
| null;
|
||||
stack: readonly string[] | null;
|
||||
experience: string | null;
|
||||
workFormats: readonly string[] | null;
|
||||
salaryCompatibility: string | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Maps the full anonymous card to display strings. A null value stays null:
|
||||
* the contract does not say whether the candidate withheld it or has none,
|
||||
* and the screen does not guess.
|
||||
*/
|
||||
export function presentCard(card: AnonymousCardContent): CardDetails {
|
||||
return {
|
||||
categories:
|
||||
card.categories?.map((category) => ({
|
||||
specialization: specializationLabels[category.specialization],
|
||||
grade: gradeLabels[category.grade],
|
||||
strength: strengthLabels[category.strength],
|
||||
})) ?? null,
|
||||
selfAssessments:
|
||||
card.self_assessment?.map((item) => ({
|
||||
specialization: specializationLabels[item.specialization],
|
||||
declaredGrade: item.declared_grade ? gradeLabels[item.declared_grade] : null,
|
||||
confirmed: item.confirmation_status === "confirmed",
|
||||
})) ?? null,
|
||||
stack: card.stack?.map((tag) => stackLabels[tag]) ?? null,
|
||||
experience: card.experience_band ? experienceBandLabels[card.experience_band] : null,
|
||||
workFormats: card.work_formats?.map((format) => workFormatLabels[format]) ?? null,
|
||||
salaryCompatibility: card.salary_compatibility
|
||||
? salaryCompatibilityLabels[card.salary_compatibility]
|
||||
: null,
|
||||
};
|
||||
}
|
||||
|
||||
export type EvidenceFact = {
|
||||
title: string;
|
||||
trust: TrustLevelValue;
|
||||
trustLabel: string;
|
||||
observedYear: number;
|
||||
basisLabel: string;
|
||||
calibrationLabel: string;
|
||||
};
|
||||
|
||||
const skillLabels: Readonly<Record<EvidenceSkillCode, string>> = {
|
||||
...specializationLabels,
|
||||
...stackLabels,
|
||||
};
|
||||
|
||||
const trustViews: Readonly<Record<number, { level: TrustLevelValue; label: string }>> = {
|
||||
0: { level: "claimed", label: "Заявлено, не подтверждено отдельно" },
|
||||
1: { level: "partial", label: "Онлайн-результат без подтверждения личности" },
|
||||
2: { level: "confirmed", label: "Результат привязан к подтвержденной личности" },
|
||||
3: { level: "confirmed", label: "Очная проверка" },
|
||||
};
|
||||
|
||||
/** Facts of the evidence section as the server lists them, with its basis and calibration. */
|
||||
export function presentEvidence(evidence: OrganizationEvidence): EvidenceFact[] {
|
||||
return evidence.items.map((fact) => {
|
||||
const trust = trustViews[fact.trust] ?? trustViews[0]!;
|
||||
return {
|
||||
title: `${skillLabels[fact.skill]}: ${gradeLabels[fact.grade]}`,
|
||||
trust: trust.level,
|
||||
trustLabel: trust.label,
|
||||
observedYear: fact.observed_year,
|
||||
basisLabel: "Синтетическая демонстрация, не проверенное измерение",
|
||||
calibrationLabel: "Пороги не откалиброваны",
|
||||
};
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user