import { Button } from '@/components/ui/Button'; import { DeferredVideo } from './DeferredVideo'; import { headers } from 'next/headers'; interface HeroVideoProps { data?: any; title?: string; subtitle?: string; description?: string; videoUrl?: string; posterImage?: any; backgroundImage?: any; ctaLabel?: string; ctaHref?: string; linkText?: string; linkHref?: string; secondaryCtaLabel?: string; secondaryCtaHref?: string; badge?: string; } import placeholders from '@/lib/placeholders.json'; export function HeroVideo(props: HeroVideoProps) { const { data } = props; const title = props.title || data?.title || 'DIE EXPERTEN FÜR KABELNETZBAU'; const subtitle = props.subtitle || props.description || data?.subtitle || 'Wir verbinden Infrastruktur mit Präzision. Von Horizontalbohrungen bis zu komplexen Leitungsnetzen.'; const explicitNoVideo = props.videoUrl === 'none' || props.videoUrl === ''; const videoUrl = explicitNoVideo ? null : (props.videoUrl || data?.videoUrl || '/assets/dummy-hero.mp4'); // In server components, we don't have usePathname, so we can extract it from headers if needed, // or just use a default fallback for the keys. const pathname = '/'; let defaultPoster = "/assets/photos/DJI_0048.JPG"; if (videoUrl && videoUrl.endsWith('.mp4')) { defaultPoster = videoUrl.replace('.mp4', '-poster-v2.webp'); } let posterSrc = props.backgroundImage?.url || props.posterImage?.url || data?.posterImage?.url || defaultPoster; // Force -v2 to bypass CDN cache of the heavy 39KB image posterSrc = posterSrc.replace('-poster.webp', '-poster-v2.webp'); const posterAlt = props.backgroundImage?.alt || data?.posterImage?.alt || "E-TIB Gruppe Baustelle"; const ctaLabel = props.ctaLabel || props.linkText || data?.ctaLabel || 'Unternehmen entdecken'; const ctaHref = props.ctaHref || props.linkHref || data?.ctaHref || '#unternehmen'; const currentLocale = 'de'; // The layout or page should technically pass the locale, but for now fallback const secondaryCtaLabel = props.secondaryCtaLabel || data?.secondaryCtaLabel || 'Projekt anfragen'; const secondaryCtaHref = props.secondaryCtaHref || data?.secondaryCtaHref || `/de/contact`; return (
{/* Background color while video loads */}
{posterAlt} {/* Fast compositing layer to replace the heavy CSS filters on the image */}
{/* Render video on top if available, but defer src to avoid blocking LCP */} {/* Cinematic Color Grading Overlay */}
{/* Dramatic Vignette & Fade to content */}
{/* Top Fade for Header Navigation Readability */}

Kabelnetzbau').replace(/KABELNETZBAU|Kabelnetzbau/g, 'Kabelnetzbau').replace(/\\n|\n/g, '
') }} />

{subtitle}

); }