refactor: remove hardcoded default content from components and update dashboard to conditionally render sections after CMS data loading
This commit is contained in:
@@ -5,37 +5,6 @@ import Image from 'next/image';
|
||||
import type { FeaturesContent, FeaturedAgentItem } from '@/types/cms';
|
||||
import { resolveImageUrl } from '@/services/cms.service';
|
||||
|
||||
const defaultContent: FeaturesContent = {
|
||||
title: 'Find Trusted Real Estate Professionals On Demand',
|
||||
subtitle: 'Quickly connect with the right agents exactly when you need them.',
|
||||
features: [
|
||||
{
|
||||
iconPath: '/assets/icons/hourglass-icon.svg',
|
||||
title: 'Hire Quickly',
|
||||
description: 'Connect with experienced local real estate agents who match your needs and preferences. Our simple process helps you get started quickly and move forward without delays or unnecessary complexity.',
|
||||
},
|
||||
{
|
||||
iconPath: '/assets/icons/verified-badge-icon.svg',
|
||||
title: 'Verified Agents',
|
||||
description: 'All agents are carefully identity-verified and background-checked to ensure trust and safety. You can confidently work with professionals who meet quality and reliability standards.',
|
||||
},
|
||||
{
|
||||
iconPath: '/assets/icons/star-orange-icon.svg',
|
||||
title: 'Top Rated',
|
||||
description: 'Work with highly rated agents known for strong expertise and positive client feedback. Their consistent performance helps you make informed and confident property decisions.',
|
||||
},
|
||||
{
|
||||
iconPath: '/assets/icons/trusted-people-icon.svg',
|
||||
title: 'Trusted by Thousands',
|
||||
description: 'Thousands of buyers, sellers, and renters trust our platform to find reliable agents. Our professionals help people navigate property journeys with confidence and ease.',
|
||||
},
|
||||
],
|
||||
featuredAgents: [
|
||||
{ name: 'Anderson', role: 'Rental & Investment Consultant', rating: '4.9', location: 'New York', experience: '7+ years in the real estate industry.', imageUrl: '/assets/images/agent-anderson.jpg' },
|
||||
{ name: 'Deepak', role: 'Rental & Investment Consultant', rating: '4.9', location: 'New York', experience: '7+ years in the real estate industry.', imageUrl: '/assets/images/agent-deepak.jpg' },
|
||||
{ name: 'Daniel', role: 'Rental & Investment Consultant', rating: '4.9', location: 'New York', experience: '7+ years in the real estate industry.', imageUrl: '/assets/images/agent-daniel.jpg' },
|
||||
],
|
||||
};
|
||||
|
||||
function AgentCard({ agent, className = '' }: { agent: FeaturedAgentItem; className?: string }) {
|
||||
const [imgLoaded, setImgLoaded] = useState(false);
|
||||
@@ -100,7 +69,8 @@ function AgentCard({ agent, className = '' }: { agent: FeaturedAgentItem; classN
|
||||
}
|
||||
|
||||
export function FeaturesSection({ content }: { content?: FeaturesContent }) {
|
||||
const data = content ?? defaultContent;
|
||||
if (!content) return null;
|
||||
const data = content;
|
||||
const agents = data.featuredAgents || [];
|
||||
const [activeCard, setActiveCard] = useState(0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user