import { useState, useEffect, useRef } from 'react'; import { useTranslation } from 'react-i18next'; import { useFadeInRef } from '../../hooks/useFadeIn'; import HexCanvas from './HexCanvas'; import BottomIllustration from './BottomIllustration'; import { TickerValue } from '../ui/TickerValue'; import { LogoIcon } from '../ui/icons/LogoIcon'; import { trackEvent } from '../../lib/analytics'; export default function HomePage({ onOpenDashboard, onOpenPricing: _onOpenPricing, theme = 'light', hidePricing: _hidePricing, }: { onOpenDashboard: () => void; onOpenPricing: () => void; theme?: 'light' | 'dark'; hidePricing?: boolean; }) { const { t } = useTranslation(); const [statsActive, setStatsActive] = useState(false); useEffect(() => { const timer = setTimeout(() => setStatsActive(true), 300); return () => clearTimeout(timer); }, []); const whyRef = useFadeInRef(); const ctaRef = useFadeInRef(); // Scroll depth tracking const scrolledSections = useRef(new Set()); useEffect(() => { const ids = ['how-it-works']; const observers: IntersectionObserver[] = []; ids.forEach((id) => { const el = document.getElementById(id); if (!el) return; const observer = new IntersectionObserver( ([entry]) => { if (entry.isIntersecting && !scrolledSections.current.has(id)) { scrolledSections.current.add(id); trackEvent('Scroll Depth', { section: id }); } }, { threshold: 0.1 } ); observer.observe(el); observers.push(observer); }); return () => observers.forEach((o) => o.disconnect()); }, []); // 30s time-on-page event useEffect(() => { const timer = setTimeout(() => trackEvent('Time on Page', { seconds: '30' }), 30000); return () => clearTimeout(timer); }, []); return (
{/* Hero */}

{t('home.heroTitle1')} {t('home.heroTitle2')}.
{t('home.heroTitle3')}

{t('home.heroSubtitle')}

{t('home.heroDescription')}

{t('home.statProperties')}
{t('home.statFilters')}
{t('home.statEvery')}
{t('home.statPostcodeInEngland')}
{/* Our philosophy */}

{t('home.ourPhilosophy')}

{t('home.philosophyP1')}

{t('home.philosophyP2')}

{/* How to use it + Comparison table (two columns) */}
{/* Left: How to use it */}

{t('home.howToUseIt')}

{[ { title: t('home.howStep1Title'), desc: t('home.howStep1Desc') }, { title: t('home.howStep2Title'), desc: t('home.howStep2Desc') }, { title: t('home.howStep3Title'), desc: t('home.howStep3Desc') }, { title: t('home.howStep4Title'), desc: t('home.howStep4Desc') }, ].map((step, i) => (
{i + 1}

{step.title}

{step.desc}

))}
{/* Right: Comparison table */}

{t('home.othersVs')}{' '} {t('header.appName')}{' '}

{[ { feature: t('home.compSearchWithout'), subtitle: t('home.compSearchWithoutSub'), listings: false, postcode: false, guides: false }, { feature: t('home.compAreaData'), subtitle: t('home.compAreaDataSub'), listings: false, postcode: true, guides: true }, { feature: t('home.compPropertyData'), subtitle: t('home.compPropertyDataSub'), listings: true, postcode: false, guides: false }, { feature: t('home.compFilters'), subtitle: t('home.compFiltersSub'), listings: false, postcode: false, guides: false }, ].map((row, i, arr) => ( {[row.listings, row.postcode, row.guides].map((has, j) => ( ))} ))}
{t('home.listingPortals')} {t('home.checkMyPostcode')} {t('home.areaGuides')} {t('header.appName')}
{row.feature} {row.subtitle && (
{row.subtitle}
)}
{has ? '\u2713' : '\u2717'}
{/* The real cost CTA */}

{t('home.ctaTitle')}

{t('home.ctaDescription')}

{/* Bottom illustration */}
); }