'use client'; import { Button } from '@/components/ui/Button'; import Image from 'next/image'; import { motion, AnimatePresence } from 'framer-motion'; import { useState, useEffect } from 'react'; import { usePathname } from 'next/navigation'; 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; } export function HeroVideo(props: HeroVideoProps) { const { data } = props; const title = props.title || data?.title || 'DIE EXPERTEN FÜR KABELTIEFBAU'; 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'); const pathname = usePathname(); const posterSrc = props.backgroundImage?.url || props.posterImage?.url || data?.posterImage?.url || "/assets/photos/DJI_0048.JPG"; 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'; let currentLocale = 'de'; try { // We can't unconditionally call hooks if they might fail outside context, but HeroVideo is usually in context. // However, to be safe and avoid adding new imports, we can use window.location or default to 'de' if not available. if (typeof window !== 'undefined') { currentLocale = window.location.pathname.startsWith('/en') ? 'en' : 'de'; } } catch (e) { // Fallback to default locale if window/location access fails } const secondaryCtaLabel = props.secondaryCtaLabel || data?.secondaryCtaLabel || (currentLocale === 'de' ? 'Projekt anfragen' : 'Inquire Project'); const secondaryCtaHref = props.secondaryCtaHref || data?.secondaryCtaHref || `/${currentLocale}/${currentLocale === 'de' ? 'contact' : 'contact'}`; return (
{subtitle}