'use client'; import { Button } from '@/components/ui/Button'; import Image from 'next/image'; 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 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'); 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'; const currentLocale = pathname?.startsWith('/en') ? 'en' : 'de'; const secondaryCtaLabel = props.secondaryCtaLabel || data?.secondaryCtaLabel || (currentLocale === 'de' ? 'Projekt anfragen' : 'Inquire Project'); const secondaryCtaHref = props.secondaryCtaHref || data?.secondaryCtaHref || `/${currentLocale}/contact`; return (
{/* Background color while video loads */}
{videoUrl ? (