diff --git a/components/blocks/HeroVideo.tsx b/components/blocks/HeroVideo.tsx index a25cabe93..01d35c41b 100644 --- a/components/blocks/HeroVideo.tsx +++ b/components/blocks/HeroVideo.tsx @@ -37,19 +37,10 @@ export function HeroVideo(props: HeroVideoProps) { 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 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}/${currentLocale === 'de' ? 'contact' : 'contact'}`; + const secondaryCtaHref = props.secondaryCtaHref || data?.secondaryCtaHref || `/${currentLocale}/contact`; return (
diff --git a/components/blocks/InteractiveGermanyMap.tsx b/components/blocks/InteractiveGermanyMap.tsx
index e8f772238..4b926b842 100644
--- a/components/blocks/InteractiveGermanyMap.tsx
+++ b/components/blocks/InteractiveGermanyMap.tsx
@@ -52,10 +52,16 @@ export function InteractiveGermanyMap({
const finalTitle = title || (locale === 'en' ? <>Nationwide
in operation for you.> : <>Deutschlandweit
für Sie im Einsatz.>);
const finalDescription = description || (locale === 'en' ? 'From our strategic locations in Guben, Kirchheilingen and Bülstedt, we control and implement complex infrastructure projects nationwide.' : 'Von unseren strategischen Standorten in Guben, Kirchheilingen und Bülstedt steuern und realisieren wir komplexe Infrastrukturprojekte im gesamten Bundesgebiet.');
- const hq = locations.find((l) => l.type === 'hq');
- const branch = locations.find((l) => l.type === 'branch');
- const projects = locations.filter((l) => l.type === 'project');
- const minorNodes = locations.filter((l) => l.type === 'minor_node');
+ const finalLocations = React.useMemo(() => {
+ // Ensure the 3 standorte are always included, without duplicating if already present by ID
+ const base = [...locations];
+ standorteLocations.forEach(sl => {
+ if (!base.some(l => l.id === sl.id)) {
+ base.push(sl as Location);
+ }
+ });
+ return base;
+ }, [locations]);
return (