diff --git a/src/components/home/FeaturesSection.tsx b/src/components/home/FeaturesSection.tsx index 2e335bd..b2742df 100644 --- a/src/components/home/FeaturesSection.tsx +++ b/src/components/home/FeaturesSection.tsx @@ -4,8 +4,6 @@ import { useState, useEffect } from 'react'; import Image from 'next/image'; import type { FeaturesContent, FeaturedAgentItem } from '@/types/cms'; import { resolveImageUrl } from '@/services/cms.service'; -import { agentsService } from '@/services/agents.service'; -import { uploadService } from '@/services/upload.service'; const defaultContent: FeaturesContent = { title: 'Find Trusted Real Estate Professionals On Demand', @@ -103,49 +101,9 @@ function AgentCard({ agent, className = '' }: { agent: FeaturedAgentItem; classN export function FeaturesSection({ content }: { content?: FeaturesContent }) { const data = content ?? defaultContent; - const [agents, setAgents] = useState([]); + const agents = data.featuredAgents || []; const [activeCard, setActiveCard] = useState(0); - useEffect(() => { - const fetchFeaturedAgents = async () => { - try { - const featured = await agentsService.getFeaturedAgents(3); - if (featured.length > 0) { - // Map API response to FeaturedAgentItem format - const mapped = await Promise.all( - featured.map(async (agent) => { - let imageUrl = '/assets/icons/user-placeholder-icon.svg'; - if (agent.avatar) { - if (agent.avatar.startsWith('http') || agent.avatar.startsWith('/')) { - imageUrl = agent.avatar; - } else { - try { - imageUrl = await uploadService.getPresignedDownloadUrl(agent.avatar); - } catch (_e) { - // use placeholder - } - } - } - return { - name: `${agent.firstName || ''} ${agent.lastName || ''}`.trim(), - role: agent.agentType?.name || '', - rating: agent.averageRating ? String(agent.averageRating) : '', - location: agent.city || agent.state || '', - experience: agent.experience ? `${agent.experience}+ years in the real estate industry.` : '', - imageUrl, - }; - }), - ); - setAgents(mapped); - } - } catch (err) { - console.error('Failed to fetch featured agents:', err); - } - }; - - fetchFeaturedAgents(); - }, []); - return (