'use client'; import { useState, useEffect } from 'react'; import Link from 'next/link'; import Image from 'next/image'; import { agentsService, PublicAgentProfile, AgentType } from '@/services/agents.service'; import { uploadService } from '@/services/upload.service'; import type { TopProfessionalsContent } from '@/types/cms'; interface ProfessionalCardProps { name: string; subtitle: string; location: string; experience: string; expertise: string[]; imageUrl: string; isVerified: boolean; rating: number | null; } function ProfessionalCard({ name, subtitle, location, experience, expertise, imageUrl, isVerified, rating, }: ProfessionalCardProps) { const starCount = rating ? Math.round(rating) : 0; const [imgLoaded, setImgLoaded] = useState(false); const [imgError, setImgError] = useState(false); const placeholder = '/assets/icons/user-placeholder-icon.svg'; const isPlaceholder = imageUrl === placeholder; const INITIAL_TAG_COUNT = 4; return (
{subtitle}
{/* Verified Badge */} {isVerified && (Location:
Expertise:
Experience: {experience}
)} {/* Star Rating */} {starCount > 0 && (No {activeTab === 'agents' ? 'agents' : 'lenders'} available yet.
{data.ctaText}
{/* Browse Experts Button */}