import { ReactNode, Suspense, useState } from "react"; import Tabs from "../../../../components/ui/tabs/Tabs"; import { PageBlockDto } from "../../dtos/PageBlockDto"; import BannerBlock from "./marketing/banner/BannerBlock"; import CommunityBlock from "./marketing/community/CommunityBlock"; import FaqBlock from "./marketing/faq/FaqBlock"; import { FeaturesBlock } from "./marketing/features/FeaturesBlock"; import { FooterBlock } from "./marketing/footer/FooterBlock"; import GalleryBlock from "./marketing/gallery/GalleryBlock"; import { HeaderBlock } from "./marketing/header/HeaderBlock"; import { HeadingBlock } from "./marketing/heading/HeadingBlock"; import { HeroBlock } from "./marketing/hero/HeroBlock"; import LogoCloudsBlock from "./marketing/logoClouds/LogoCloudsBlock"; import NewsletterBlock from "./marketing/newsletter/NewsletterBlock"; import PricingBlock from "./marketing/pricing/PricingBlock"; import TestimonialsBlock from "./marketing/testimonials/TestimonialsBlock"; import VideoBlock from "./marketing/video/VideoBlock"; import PageBlockBoundary from "./PageBlockBoundary"; import JsonBlockForm from "./shared/layout/json/JsonBlockForm"; import LayoutBlockForm from "./shared/layout/LayoutBlockForm"; type UserSession = any; export function PageBlock({ item, userSession }: { item: PageBlockDto; userSession?: UserSession }) { return ( <> {item.heading && } {item.banner && } {item.header && }> } {item.footer && } {item.hero && } {item.gallery && } {item.logoClouds && } {item.video && } {item.community && } {item.testimonials && } {item.features && } {item.newsletter && } {item.faq && } {item.pricing && } {/* {item.rowsList && } {item.rowsNew && } {item.rowsOverview && } */} ); } export function PageBlockForm({ type, item, onUpdate }: { type: string; item?: PageBlockDto; onUpdate: (item: PageBlockDto) => void }) { let block: ReactNode | null = null; /* if (type === "heading") { block = onUpdate({ heading })} />; } else if (type === "banner") { block = onUpdate({ banner })} />; } else if (type === "header") { block = onUpdate({ header })} />; } else if (type === "footer") { block = onUpdate({ footer })} />; } else if (type === "hero") { block = onUpdate({ hero })} />; } else if (type === "logoClouds") { block = onUpdate({ logoClouds })} />; } else if (type === "gallery") { block = onUpdate({ gallery })} />; } else if (type === "video") { block = onUpdate({ video })} />; } else if (type === "community") { block = onUpdate({ community })} />; } else if (type === "testimonials") { block = onUpdate({ testimonials })} />; } else if (type === "faq") { block = onUpdate({ faq })} />; } else if (type === "features") { block = onUpdate({ features })} />; } else if (type === "newsletter") { block = onUpdate({ newsletter })} />; } else if (type === "pricing") { block = onUpdate({ pricing })} />; } else if (type === "rowsList") { block = onUpdate({ rowsList })} />; } else if (type === "rowsNew") { block = onUpdate({ rowsNew })} />; } else if (type === "rowsOverview") { block = onUpdate({ rowsOverview })} />; } else { block = ; } */ const [selectedTab, selectTab] = useState(0); return (
selectTab(index)} tabs={[{ name: `Block` }, { name: `JSON` }]} /> {selectedTab === 0 && ( <> {block} onUpdate(layout)} /> )} {selectedTab === 1 && onUpdate(block)} />}
); }