feat: Implement S3 presigned URL resolution for CMS images across pages and apply minor styling adjustments to the header and hero sections.
This commit is contained in:
@@ -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<string, unknown> = {};
|
||||
sections.forEach((s: CmsContentRecord) => {
|
||||
data[s.sectionKey] = s.content;
|
||||
});
|
||||
for (const s of sections) {
|
||||
const content = s.content as Record<string, unknown>;
|
||||
// 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();
|
||||
|
||||
Reference in New Issue
Block a user