import React from 'react'; import { Head, Link, useForm } from '@inertiajs/react'; import { useTranslation } from 'react-i18next'; import { useLocalizedRoutes } from '@/hooks/useLocalizedRoutes'; import MarketingLayout from '@/layouts/mainWebsite'; import { useAnalytics } from '@/hooks/useAnalytics'; import { useCtaExperiment } from '@/hooks/useCtaExperiment'; import { Badge } from '@/components/ui/badge'; import { Button } from '@/components/ui/button'; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; import { Textarea } from '@/components/ui/textarea'; import { ArrowRight, Camera, QrCode, ShieldCheck, Sparkles, Smartphone, Loader2, CheckCircle2 } from 'lucide-react'; import { usePage } from '@inertiajs/react'; import { motion, useReducedMotion } from 'framer-motion'; interface Package { id: number; name: string; description: string; price: number; } interface Props { packages: Package[]; } interface HoneypotPayload { enabled: boolean; nameFieldName: string; validFromFieldName: string; encryptedValidFrom: string; } type ContactFormData = { name: string; email: string; message: string; [key: string]: string; }; const heroBulletIcons = [Sparkles, ShieldCheck, Camera]; const howStepIcons = [QrCode, Smartphone, ShieldCheck]; const Home: React.FC = ({ packages }) => { const { t } = useTranslation('marketing'); const { localizedPath } = useLocalizedRoutes(); const { trackEvent } = useAnalytics(); const { variant: heroCtaVariant, trackClick: trackHeroCtaClick, } = useCtaExperiment('home_hero_cta'); const { flash, honeypot } = usePage<{ flash?: { success?: string }; honeypot?: HoneypotPayload }>().props; const shouldReduceMotion = useReducedMotion(); const honeypotDefaults = React.useMemo(() => { if (!honeypot?.enabled) { return {}; } return { [honeypot.nameFieldName]: '', [honeypot.validFromFieldName]: honeypot.encryptedValidFrom, }; }, [honeypot?.enabled, honeypot?.encryptedValidFrom, honeypot?.nameFieldName, honeypot?.validFromFieldName]); const { data, setData, post, processing, errors, reset } = useForm({ name: '', email: '', message: '', ...honeypotDefaults, }); const viewportOnce = { once: true, amount: 0.25 }; const revealUp = { hidden: { opacity: 0, y: shouldReduceMotion ? 0 : 18 }, visible: { opacity: 1, y: 0, transition: { duration: 0.6, ease: [0.22, 1, 0.36, 1] }, }, }; const revealFadeIn = { hidden: { opacity: 0 }, visible: { opacity: 1, transition: { duration: 0.5, ease: 'easeOut' } }, }; const revealFade = { hidden: { opacity: 0 }, visible: { opacity: 1, transition: { duration: 0.5, ease: 'easeOut' } }, }; const stagger = { hidden: {}, visible: { transition: { staggerChildren: 0.12 } }, }; const heroCardVariants = shouldReduceMotion ? { rest: {}, hover: {} } : { rest: { y: 0, scale: 1, rotateX: 0, rotateY: 0 }, hover: { y: -8, scale: 1.01, rotateX: -2, rotateY: 3, transition: { type: 'spring', stiffness: 180, damping: 20 }, }, }; const heroGlowVariants = shouldReduceMotion ? { rest: {}, hover: {} } : { rest: { opacity: 0.4, scale: 1 }, hover: { opacity: 0.7, scale: 1.03, transition: { duration: 0.35, ease: 'easeOut' } }, }; const heroShineVariants = shouldReduceMotion ? { rest: {}, hover: {} } : { rest: { x: '-120%', opacity: 0 }, hover: { x: '120%', opacity: 0.8, transition: { duration: 0.8, ease: 'easeOut' } }, }; const heroBulletsRaw = t('home.hero_bullets', { returnObjects: true }); const heroBullets = Array.isArray(heroBulletsRaw) ? (heroBulletsRaw as string[]) : []; const featuresRaw = t('home.features_highlight', { returnObjects: true }); const features = Array.isArray(featuresRaw) ? (featuresRaw as Array<{ title: string; description: string }>) : []; const howSteps = [ { icon: howStepIcons[0] ?? QrCode, title: t('home.step1_title'), description: t('home.step1_desc'), }, { icon: howStepIcons[1] ?? Smartphone, title: t('home.step2_title'), description: t('home.step2_desc'), }, { icon: howStepIcons[2] ?? ShieldCheck, title: t('home.step3_title'), description: t('home.step3_desc'), }, ]; const occasionLinks = [ { key: 'wedding', href: localizedPath('/anlaesse/hochzeit') }, { key: 'birthday', href: localizedPath('/anlaesse/geburtstag') }, { key: 'corporate', href: localizedPath('/anlaesse/firmenevent') }, { key: 'confirmation', href: localizedPath('/anlaesse/konfirmation') }, ]; const heroPrimaryHref = localizedPath('/demo'); const heroPrimaryLabel = heroCtaVariant === 'gradient' ? t('home.cta_demo_highlight') : t('home.cta_demo'); const heroSecondaryHref = localizedPath('/so-funktionierts'); const heroSecondaryLabel = t('home.cta_how'); const heroTertiaryHref = localizedPath('/packages'); const heroTertiaryLabel = t('home.cta_packages'); const handleSubmit = (event: React.FormEvent) => { event.preventDefault(); post(localizedPath('/kontakt'), { onSuccess: () => { trackEvent({ category: 'marketing_home', action: 'contact_submit', }); reset(); }, }); }; React.useEffect(() => { if (Object.keys(errors).length > 0) { window.scrollTo({ top: 0, behavior: 'smooth' }); } }, [errors]); return (
{t('home.hero_tagline')} {t('home.hero_title')} {t('home.hero_description')} {heroBullets.length > 0 && ( {heroBullets.map((item, index) => { const Icon = heroBulletIcons[index % heroBulletIcons.length] ?? Sparkles; return ( {item} ); })} )}
trackEvent({ category: 'marketing_home', action: 'hero_packages_cta', }) } className="font-semibold text-rose-500 underline-offset-4 hover:underline dark:text-rose-200" > {heroTertiaryLabel}

{t('home.how_title')}

{t('home.how_subtitle')}

{howSteps.map(({ icon: Icon, title, description }, index) => ( {title} {description} ))}
{t('home.demo_title')} {t('home.demo_description')} {t('home.demo_hint')}

{t('home.demo_media_alt')}

trackEvent({ category: 'marketing_home', action: 'demo_frame_cta', }) } className="text-sm font-semibold text-white underline-offset-4 hover:underline" > {t('home.demo_cta')}

{t('home.features_title')}

{features.map((feature, index) => ( {feature.title} {feature.description} ))}
{t('home.occasions_title')} {t('home.occasions_description')} {occasionLinks.map(({ key, href }) => ( trackEvent({ category: 'marketing_home', action: 'occasion_tile_click', name: key, }) } className="group flex items-center gap-3 rounded-xl border border-rose-100/60 bg-white/80 px-4 py-3 text-sm font-semibold text-rose-600 shadow-sm shadow-rose-100/50 transition hover:bg-rose-50 hover:text-rose-700 dark:border-rose-500/30 dark:bg-gray-900/70 dark:text-rose-200 dark:hover:bg-rose-500/10" > {t(`home.occasions.${key}`)} ))} {t('home.blog_teaser_title')} {t('home.blog_teaser_description')}

{t('home.packages_title')}

{t('home.packages_subtitle')}

{packages.slice(0, 2).map((pkg) => ( {pkg.name} {pkg.description}

{pkg.price} {t('currency.euro')}

))}
{t('home.contact_title')} {t('home.contact_lead')} {flash?.success ? (
{flash.success}
) : null}

{t('home.contact_title')}

{t('home.contact_lead')}

  • {t('home.hero_bullets.0', 'Antwort in <24h')}
  • {t('home.hero_bullets.1', 'Keine Weitergabe, kein Tracking')}
  • {t('home.contact_privacy')}
{t('home.contact_privacy')}
{honeypot?.enabled ? (
setData(honeypot.nameFieldName, event.target.value)} autoComplete="off" tabIndex={-1} />
) : null}
setData('name', event.target.value)} className="h-12 rounded-xl border-gray-200/70 bg-white/90 shadow-inner shadow-gray-200/40 focus-visible:ring-rose-300/60 dark:border-gray-700 dark:bg-gray-900/70" autoComplete="name" required aria-invalid={Boolean(errors.name)} aria-describedby={errors.name ? 'contact-name-error' : undefined} /> {errors.name && (

{errors.name}

)}
setData('email', event.target.value)} className="h-12 rounded-xl border-gray-200/70 bg-white/90 shadow-inner shadow-gray-200/40 focus-visible:ring-rose-300/60 dark:border-gray-700 dark:bg-gray-900/70" autoComplete="email" required aria-invalid={Boolean(errors.email)} aria-describedby={errors.email ? 'contact-email-error' : undefined} /> {errors.email && (

{errors.email}

)}