feat: Implement 'Show More/Less' functionality for specialization cards, refine expertise tag extraction logic, and update the 'Browse Experts' navigation link.

This commit is contained in:
pradeepkumar
2026-02-02 16:24:39 +05:30
parent 1faed9140c
commit 719b784dfe
3 changed files with 57 additions and 22 deletions

View File

@@ -168,18 +168,24 @@ function ProfileCard({ profile }: ProfileCardProps) {
return null;
};
// Extract expertise tags from fieldValues
// Extract expertise tags from fieldValues - only include expertise-related fields
const getExpertiseTags = (): string[] => {
const tags: string[] = [];
// Fields to exclude from tags (they're displayed elsewhere, e.g., state/city shown in location)
const excludedFieldSlugs = ['state', 'city', 'description'];
// Only include expertise-related field slugs (matching profileDataMapper.ts)
const expertiseFieldSlugs = [
'about_me_expertise',
'expertise_areas',
'specializations',
'areas_of_expertise',
'expertise',
];
// Add from fieldValues (dynamic profile fields like client_specialization, property_type, loan_type)
// Add from fieldValues - only expertise-related fields
if (profile.fieldValues && profile.fieldValues.length > 0) {
profile.fieldValues.forEach((fv) => {
// Skip excluded fields
if (excludedFieldSlugs.includes(fv.field.slug)) {
// Only include expertise-related fields
if (!expertiseFieldSlugs.includes(fv.field.slug)) {
return;
}
@@ -193,11 +199,15 @@ function ProfileCard({ profile }: ProfileCardProps) {
.split('_')
.map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
.join(' ');
tags.push(displayValue);
if (!tags.includes(displayValue)) {
tags.push(displayValue);
}
}
});
} else if (typeof value === 'string' && value.trim()) {
tags.push(value);
if (!tags.includes(value)) {
tags.push(value);
}
}
});
}