From da805fbc5cadde169e268e9f9f06a6354fd95376 Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Mon, 20 Apr 2026 10:31:51 +0530 Subject: [PATCH] feat: add profile links to featured agents and professionals by updating CMS types and card components --- src/components/home/FeaturesSection.tsx | 10 ++++-- src/components/home/TopProfessionals.tsx | 40 ++++++++++++++++-------- src/types/cms.ts | 2 ++ 3 files changed, 37 insertions(+), 15 deletions(-) diff --git a/src/components/home/FeaturesSection.tsx b/src/components/home/FeaturesSection.tsx index bffa99f..a789c16 100644 --- a/src/components/home/FeaturesSection.tsx +++ b/src/components/home/FeaturesSection.tsx @@ -2,6 +2,7 @@ import { useState, useEffect } from 'react'; import Image from 'next/image'; +import Link from 'next/link'; import type { FeaturesContent, FeaturedAgentItem } from '@/types/cms'; import { resolveImageUrl } from '@/services/cms.service'; @@ -21,8 +22,8 @@ function AgentCard({ agent, className = '' }: { agent: FeaturedAgentItem; classN } }, [agent.imageUrl]); - return ( -
+ const cardInner = ( +
{imgSrc && (
); + + if (agent.id) { + return {cardInner}; + } + return cardInner; } export function FeaturesSection({ content }: { content?: FeaturesContent }) { diff --git a/src/components/home/TopProfessionals.tsx b/src/components/home/TopProfessionals.tsx index bb26f15..5c3f713 100644 --- a/src/components/home/TopProfessionals.tsx +++ b/src/components/home/TopProfessionals.tsx @@ -211,6 +211,7 @@ async function resolveAvatarUrl(avatar: string | null): Promise { interface DisplayProfessional { id: string; + profileId?: string; name: string; subtitle: string; location: string; @@ -249,6 +250,7 @@ export function TopProfessionals({ content }: { content?: TopProfessionalsConten const imageUrl = await resolveAvatarUrl(entry.imageUrl || null); return { id: `cms-${index}`, + profileId: entry.id, name: entry.name, subtitle: entry.subtitle || '', location: entry.location || '', @@ -358,19 +360,31 @@ export function TopProfessionals({ content }: { content?: TopProfessionalsConten ))} ) : displayData.length > 0 ? ( - displayData.map((professional) => ( - - )) + displayData.map((professional) => { + const card = ( + + ); + return professional.profileId ? ( + + {card} + + ) : ( +
{card}
+ ); + }) ) : ( // No data message
diff --git a/src/types/cms.ts b/src/types/cms.ts index 2472298..b418b77 100644 --- a/src/types/cms.ts +++ b/src/types/cms.ts @@ -12,6 +12,7 @@ export interface FeatureItem { } export interface FeaturedAgentItem { + id?: string; name: string; role: string; rating: string; @@ -28,6 +29,7 @@ export interface FeaturesContent { } export interface ProfessionalItem { + id?: string; name: string; subtitle: string; location: string;