diff --git a/src/app/(marketing)/home-content-v2.tsx b/src/app/(marketing)/home-content-v2.tsx new file mode 100644 index 0000000..e508271 --- /dev/null +++ b/src/app/(marketing)/home-content-v2.tsx @@ -0,0 +1,88 @@ +'use client'; + +import { useEffect } from 'react'; +import { useSearchParams } from 'next/navigation'; +import dynamic from 'next/dynamic'; +import { HeroSectionV2 } from '@/components/sections/hero-section-v2'; +import { SectionSkeleton } from '@/components/ui/loading-skeleton'; + +declare global { + interface Window { + __isProgrammaticScroll?: boolean; + } +} + +const SocialProofSection = dynamic( + () => import('@/components/sections/social-proof-section').then(mod => ({ default: mod.SocialProofSection })), + { loading: () => , ssr: false } +); + +const ProductMatrixSection = dynamic( + () => import('@/components/sections/product-matrix-section').then(mod => ({ default: mod.ProductMatrixSection })), + { loading: () => , ssr: false } +); + +const ChallengeSection = dynamic( + () => import('@/components/sections/challenge-section').then(mod => ({ default: mod.ChallengeSection })), + { loading: () => , ssr: false } +); + +const TestimonialSection = dynamic( + () => import('@/components/sections/testimonial-section').then(mod => ({ default: mod.TestimonialSection })), + { loading: () => , ssr: false } +); + +const CTASection = dynamic( + () => import('@/components/sections/cta-section').then(mod => ({ default: mod.CTASection })), + { loading: () => , ssr: false } +); + +function HomeContentV2() { + const searchParams = useSearchParams(); + + useEffect(() => { + const section = searchParams.get('section'); + if (!section) {return;} + + const maxAttempts = 50; + const interval = 100; + let attempts = 0; + + const scrollToSection = () => { + const targetElement = document.getElementById(section); + if (targetElement) { + window.__isProgrammaticScroll = true; + targetElement.scrollIntoView({ behavior: 'smooth', block: 'start' }); + setTimeout(() => { + window.__isProgrammaticScroll = false; + }, 2000); + return true; + } + return false; + }; + + if (scrollToSection()) {return;} + + const timer = setInterval(() => { + attempts++; + if (scrollToSection() || attempts >= maxAttempts) { + clearInterval(timer); + } + }, interval); + + return () => clearInterval(timer); + }, [searchParams]); + + return ( +
+ + + + + + +
+ ); +} + +export { HomeContentV2 }; diff --git a/src/app/(marketing)/page.tsx b/src/app/(marketing)/page.tsx index 20238ad..453003e 100644 --- a/src/app/(marketing)/page.tsx +++ b/src/app/(marketing)/page.tsx @@ -1,12 +1,11 @@ import { Suspense } from 'react'; -import { HomeContent } from './home-content'; +import { HomeContentV2 } from './home-content-v2'; import { SectionSkeleton } from '@/components/ui/loading-skeleton'; -import { HeroStatsSSR } from '@/components/sections/hero-stats-ssr'; export default function HomePage() { return ( }> - } /> + ); }