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:
@@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user