diff --git a/src/app/(user)/user/profiles/page.tsx b/src/app/(user)/user/profiles/page.tsx index 0a0fee0..25feea6 100644 --- a/src/app/(user)/user/profiles/page.tsx +++ b/src/app/(user)/user/profiles/page.tsx @@ -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); + } } }); } diff --git a/src/components/home/TopProfessionals.tsx b/src/components/home/TopProfessionals.tsx index a197fc9..1a48d33 100644 --- a/src/components/home/TopProfessionals.tsx +++ b/src/components/home/TopProfessionals.tsx @@ -273,7 +273,7 @@ export function TopProfessionals() {

{/* Browse Experts Button */} - + diff --git a/src/components/profile/SpecializationCard.tsx b/src/components/profile/SpecializationCard.tsx index 5080388..a7d9704 100644 --- a/src/components/profile/SpecializationCard.tsx +++ b/src/components/profile/SpecializationCard.tsx @@ -1,36 +1,61 @@ 'use client'; +import { useState } from 'react'; import Image from 'next/image'; interface SpecializationCardProps { title: string; items: string[]; icon: React.ReactNode; + initialItemsToShow?: number; } -export function SpecializationCard({ title, items, icon }: SpecializationCardProps) { +export function SpecializationCard({ + title, + items, + icon, + initialItemsToShow = 3 +}: SpecializationCardProps) { + const [isExpanded, setIsExpanded] = useState(false); + + // Determine if we need to show the toggle button + const hasMoreItems = items.length > initialItemsToShow; + + // Get the items to display based on expanded state + const displayedItems = isExpanded ? items : items.slice(0, initialItemsToShow); + + const handleToggle = () => { + setIsExpanded(!isExpanded); + }; + return (
{icon}

{title}

- {items.map((item, idx) => ( + {displayedItems.map((item, idx) => (

{item}

))}
-
- -
+ {hasMoreItems && ( +
+ +
+ )}
); }