diff --git a/src/app/(user)/user/dashboard/page.tsx b/src/app/(user)/user/dashboard/page.tsx index e3c47ee..7868f9b 100644 --- a/src/app/(user)/user/dashboard/page.tsx +++ b/src/app/(user)/user/dashboard/page.tsx @@ -5,7 +5,7 @@ import { HeroSection } from '@/components/home/HeroSection'; import { FeaturesSection } from '@/components/home/FeaturesSection'; import { TopProfessionals } from '@/components/home/TopProfessionals'; import { TestimonialsSection } from '@/components/home/TestimonialsSection'; -import { cmsService } from '@/services/cms.service'; +import { cmsService, resolveImageUrl } from '@/services/cms.service'; import type { HeroContent, FeaturesContent, TopProfessionalsContent, TestimonialsContent, CmsContentRecord } from '@/types/cms'; export default function UserDashboard() { @@ -15,9 +15,21 @@ export default function UserDashboard() { const fetchCms = async () => { const sections = await cmsService.getPageContent('landing'); const data: Record = {}; - sections.forEach((s: CmsContentRecord) => { - data[s.sectionKey] = s.content; - }); + for (const s of sections) { + const content = s.content as Record; + // Resolve S3 keys in image fields + if (s.sectionKey === 'features' && Array.isArray(content.features)) { + for (const feat of content.features as { iconPath?: string }[]) { + if (feat.iconPath) feat.iconPath = await resolveImageUrl(feat.iconPath); + } + } + if (s.sectionKey === 'testimonials' && Array.isArray(content.stats)) { + for (const stat of content.stats as { iconPath?: string }[]) { + if (stat.iconPath) stat.iconPath = await resolveImageUrl(stat.iconPath); + } + } + data[s.sectionKey] = content; + } setCmsData(data); }; fetchCms(); diff --git a/src/app/about/page.tsx b/src/app/about/page.tsx index 7ff68c0..f19cbb5 100644 --- a/src/app/about/page.tsx +++ b/src/app/about/page.tsx @@ -6,7 +6,7 @@ import Link from 'next/link'; import { useSession } from 'next-auth/react'; import { CommonHeader } from '@/components/layout/CommonHeader'; import { Footer } from '@/components/layout/Footer'; -import { cmsService } from '@/services/cms.service'; +import { cmsService, resolveImageUrl } from '@/services/cms.service'; import type { AboutHeroContent, AboutStatsContent, @@ -93,28 +93,43 @@ export default function AboutPage() { const [cta, setCta] = useState(defaultCta); useEffect(() => { - cmsService.getPageContent('about').then((sections) => { - sections.forEach((s: CmsContentRecord) => { + cmsService.getPageContent('about').then(async (sections) => { + for (const s of sections) { const c = s.content as Record; - // Only apply CMS content if it has meaningful data; otherwise keep defaults switch (s.sectionKey) { case 'hero': - if (c.headline || c.description) setHero(c as unknown as AboutHeroContent); + if (c.headline || c.description) { + const heroData = c as unknown as AboutHeroContent; + heroData.bannerImageUrl = await resolveImageUrl(heroData.bannerImageUrl); + setHero(heroData); + } break; case 'stats': if (Array.isArray(c.stats) && c.stats.length > 0) setStats(c as unknown as AboutStatsContent); break; case 'features': - if (c.badge || (Array.isArray(c.features) && c.features.length > 0)) setFeatures(c as unknown as AboutFeaturesContent); + if (c.badge || (Array.isArray(c.features) && c.features.length > 0)) { + const featData = c as unknown as AboutFeaturesContent; + for (const feat of featData.features) { + feat.iconPath = await resolveImageUrl(feat.iconPath); + } + setFeatures(featData); + } break; case 'team': - if (Array.isArray(c.members) && c.members.length > 0) setTeam(c as unknown as AboutTeamContent); + if (Array.isArray(c.members) && c.members.length > 0) { + const teamData = c as unknown as AboutTeamContent; + for (const member of teamData.members) { + member.imageUrl = await resolveImageUrl(member.imageUrl); + } + setTeam(teamData); + } break; case 'cta': if (c.title || c.description) setCta(c as unknown as AboutCtaContent); break; } - }); + } }); }, []); diff --git a/src/app/faq/page.tsx b/src/app/faq/page.tsx index aac0432..ec9f1c3 100644 --- a/src/app/faq/page.tsx +++ b/src/app/faq/page.tsx @@ -4,7 +4,7 @@ import Image from 'next/image'; import { useState, useEffect } from 'react'; import { CommonHeader } from '@/components/layout/CommonHeader'; import { Footer } from '@/components/layout/Footer'; -import { cmsService } from '@/services/cms.service'; +import { cmsService, resolveImageUrl } from '@/services/cms.service'; import { FaqContent, FaqCategoryItem, FaqItem, CmsContentRecord } from '@/types/cms'; const defaultCategories: FaqCategoryItem[] = [ @@ -91,6 +91,12 @@ export default function FAQPage() { setCategories(cmsCategories); } if (content.faqs && content.faqs.length > 0) { + // Resolve S3 keys for FAQ icons + for (const faq of content.faqs) { + if (faq.icon) { + faq.icon = await resolveImageUrl(faq.icon); + } + } setFaqs(content.faqs); setExpandedFaq(content.faqs[0]?.id ?? null); } diff --git a/src/components/home/HeroSection.tsx b/src/components/home/HeroSection.tsx index b3d476f..5f0b3be 100644 --- a/src/components/home/HeroSection.tsx +++ b/src/components/home/HeroSection.tsx @@ -98,7 +98,7 @@ export function HeroSection({ content }: { content?: HeroContent }) { }; return ( -
+
{/* Background Image */}
-
+
{/* Headline */}

@@ -245,8 +245,8 @@ export function HeroSection({ content }: { content?: HeroContent }) {

- {/* Bottom Section - pushed to bottom */} -
+ {/* Bottom Section */} +
{/* See All Agents Button */}