|
|
@ -404,18 +404,44 @@ export default function NewMatchProfilePage({ |
|
|
|
|
|
|
|
|
const candidateName = useMemo(() => { |
|
|
const candidateName = useMemo(() => { |
|
|
const publicInfo = profile?.match_summary?.public_info ?? []; |
|
|
const publicInfo = profile?.match_summary?.public_info ?? []; |
|
|
|
|
|
const firstNameIdx = publicInfo.findIndex( |
|
|
|
|
|
(f) => |
|
|
|
|
|
f.key === "personal_identity.first_name" || |
|
|
|
|
|
f.key?.endsWith(".first_name"), |
|
|
|
|
|
); |
|
|
|
|
|
const lastNameIdx = publicInfo.findIndex( |
|
|
|
|
|
(f) => |
|
|
|
|
|
f.key === "personal_identity.last_name" || |
|
|
|
|
|
f.key?.endsWith(".last_name"), |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if (firstNameIdx !== -1 && publicInfo[firstNameIdx].value) { |
|
|
|
|
|
const firstName = formatFieldValue(publicInfo[firstNameIdx].value); |
|
|
|
|
|
if (lastNameIdx !== -1 && publicInfo[lastNameIdx].value) { |
|
|
|
|
|
const lastName = formatFieldValue(publicInfo[lastNameIdx].value); |
|
|
|
|
|
return `${firstName} ${lastName}`.trim(); |
|
|
|
|
|
} |
|
|
|
|
|
return firstName || ""; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
const nameField = publicInfo.find( |
|
|
const nameField = publicInfo.find( |
|
|
(f) => |
|
|
(f) => |
|
|
f.key === "q1_full_name" || |
|
|
f.key === "q1_full_name" || |
|
|
f.key.toLowerCase().includes("name") || |
|
|
|
|
|
f.key.toLowerCase().includes("nam") || |
|
|
|
|
|
f.label.includes("نام"), |
|
|
|
|
|
|
|
|
f.key.endsWith(".full_name") || |
|
|
|
|
|
f.key.toLowerCase().includes("fullname") || |
|
|
|
|
|
f.key.toLowerCase().includes("display_name"), |
|
|
); |
|
|
); |
|
|
const formatted = formatFieldValue(nameField?.value ?? null); |
|
|
const formatted = formatFieldValue(nameField?.value ?? null); |
|
|
if (formatted) return formatted; |
|
|
if (formatted) return formatted; |
|
|
|
|
|
|
|
|
const firstVal = publicInfo.find((f) => Boolean(f.value))?.value ?? null; |
|
|
const firstVal = publicInfo.find((f) => Boolean(f.value))?.value ?? null; |
|
|
return formatFieldValue(firstVal) || "نامشخص"; |
|
|
|
|
|
}, [profile?.match_summary?.public_info]); |
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
|
formatFieldValue(firstVal) || |
|
|
|
|
|
(profile?.match_summary?.id |
|
|
|
|
|
? `Profile #${profile.match_summary.id}` |
|
|
|
|
|
: "Profile") |
|
|
|
|
|
); |
|
|
|
|
|
}, [profile?.match_summary]); |
|
|
|
|
|
|
|
|
const isCandidateFemale = |
|
|
const isCandidateFemale = |
|
|
profile?.match_summary?.gender === "female" || profile?.gender === "male"; |
|
|
profile?.match_summary?.gender === "female" || profile?.gender === "male"; |
|
|
|