import type { PageSection, Category, AccordionSectionPayload, ContactInfoSectionPayload, ContactFormSectionPayload } from '@homaroma/types'; import DynamicHero from './DynamicHero'; import DynamicHeroV2 from './DynamicHeroV2'; import DynamicUspBar from './DynamicUspBar'; import DynamicCategories from './DynamicCategories'; import DynamicProducts from './DynamicProducts'; import DynamicBanner from './DynamicBanner'; import DynamicText from './DynamicText'; import DynamicAnnouncementBar from './DynamicAnnouncementBar'; import DynamicNewsletter from './DynamicNewsletter'; import DynamicEditorialTile from './DynamicEditorialTile'; import DynamicEditorialCarousel from './DynamicEditorialCarousel'; import DynamicHeroArticle from './DynamicHeroArticle'; import DynamicScentNotesBreakdown from './DynamicScentNotesBreakdown'; import DynamicQuoteCallout from './DynamicQuoteCallout'; import DynamicProductCarousel from './DynamicProductCarousel'; import DynamicRichText from './DynamicRichText'; import AccordionSection from './sections/AccordionSection'; import ContactInfoSection from './sections/ContactInfoSection'; import ContactFormSection from './sections/ContactFormSection'; import ScrollReveal from './ScrollReveal'; interface DynamicPageRendererProps { sections: PageSection[]; categories: Category[]; categoriesLoading: boolean; } export default function DynamicPageRenderer({ sections, categories, categoriesLoading }: DynamicPageRendererProps) { return (
{sections.map((section) => { if (!section.isActive) return null; switch (section.type.toUpperCase()) { // ไม่ animate — แสดงตั้งแต่ต้น case 'ANNOUNCEMENT_BAR': return ; case 'HERO': return ; case 'HERO_V2': return ; case 'USP_BAR': return ; // animate เมื่อ scroll เข้า viewport case 'NEWSLETTER': return ; case 'CATEGORIES': return ( ); case 'PRODUCTS': return ( ); case 'BANNER': return ; case 'TEXT': return ; case 'RICH_TEXT': return ; case 'EDITORIAL_TILE': return ; case 'EDITORIAL_CAROUSEL': return ; case 'HERO_ARTICLE': return ; case 'SCENT_NOTES_BREAKDOWN': return ; case 'QUOTE_CALLOUT': return ; case 'PRODUCT_CAROUSEL': return ; case 'ACCORDION': return ; case 'CONTACT_INFO': return ; case 'CONTACT_FORM': return ; default: console.warn(`[DynamicPageRenderer] Unknown block type: ${section.type}`); return null; } })}
); }