From 9134d6b0704a8e36b156dcecfdd7dd32e3920450 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Wed, 10 Jun 2026 11:39:38 +0200 Subject: [PATCH] feat(task-12): link Bohrtechnik to service pages and remove reference detailed links --- app/[locale]/referenzen/page.tsx | 26 ++++-------- components/blocks/ReferencesSlider.test.tsx | 44 +++------------------ components/blocks/ReferencesSlider.tsx | 13 ++---- content/de/home.mdx | 1 + content/en/home.mdx | 1 + lib/map-data.ts | 6 --- tests/task-12-links.test.ts | 38 ++++++++++++++++++ 7 files changed, 57 insertions(+), 72 deletions(-) create mode 100644 tests/task-12-links.test.ts diff --git a/app/[locale]/referenzen/page.tsx b/app/[locale]/referenzen/page.tsx index 66ed2ca6e..b81f814cf 100644 --- a/app/[locale]/referenzen/page.tsx +++ b/app/[locale]/referenzen/page.tsx @@ -3,7 +3,7 @@ import { getTranslations, setRequestLocale } from 'next-intl/server'; import { Metadata } from 'next'; import { getAllReferences } from '@/lib/references'; import TrackedLink from '@/components/analytics/TrackedLink'; -import { MapPin, Calendar, Briefcase, ArrowUpRight } from 'lucide-react'; +import { MapPin, Calendar, Briefcase } from 'lucide-react'; import { getButtonClasses, ButtonOverlay } from '@/components/ui/Button'; import { SITE_URL } from '@/lib/schema'; import Image from 'next/image'; @@ -85,14 +85,9 @@ export default async function ReferenzenOverview(props: { params: Promise<{ loca
{references.map((ref) => ( -
{/* Image Section */} @@ -102,14 +97,14 @@ export default async function ReferenzenOverview(props: { params: Promise<{ loca src={ref.frontmatter.featuredImage} alt={ref.frontmatter.title} fill - className="object-cover group-hover:scale-105 transition-transform duration-1000 ease-[cubic-bezier(0.16,1,0.3,1)] filter grayscale-[20%] group-hover:grayscale-0" + className="object-cover transition-transform duration-1000 ease-[cubic-bezier(0.16,1,0.3,1)] filter grayscale-[20%]" /> ) : (
E-TIB Logo
)} -
+
{/* Location Badge */}
@@ -122,12 +117,12 @@ export default async function ReferenzenOverview(props: { params: Promise<{ loca {/* Content Section */}
-

+

{ref.frontmatter.title}

{/* Technical Meta Data */} -
+
{t('client')} @@ -144,13 +139,8 @@ export default async function ReferenzenOverview(props: { params: Promise<{ loca
- - {/* Industrial Hover Indicator */} -
- -
- +
))}
diff --git a/components/blocks/ReferencesSlider.test.tsx b/components/blocks/ReferencesSlider.test.tsx index 7c5fcca2a..a287df4b2 100644 --- a/components/blocks/ReferencesSlider.test.tsx +++ b/components/blocks/ReferencesSlider.test.tsx @@ -1,8 +1,7 @@ import * as React from 'react'; import { describe, it, expect, vi } from 'vitest'; -import { render, screen, fireEvent } from '@testing-library/react'; +import { render, screen } from '@testing-library/react'; import { ReferencesSlider, Reference } from './ReferencesSlider'; -import { NextIntlClientProvider } from 'next-intl'; // Mock next/link to render standard tag vi.mock('next/link', () => ({ @@ -52,45 +51,14 @@ describe('ReferencesSlider TDD', () => { expect(screen.getByText('Referenz Projekt Zwei')).toBeTruthy(); }); - it('wraps each tile in a link to /referenzen/[slug]', () => { + it('renders each tile as a static block and NOT wrapped in a link', () => { render(); - const links = screen.getAllByTestId('reference-tile-link'); - expect(links).toHaveLength(2); - expect(links[0].getAttribute('href')).toBe('/en/referenzen/referenz-projekt-eins'); - expect(links[1].getAttribute('href')).toBe('/en/referenzen/referenz-projekt-zwei'); - }); + const links = screen.queryAllByTestId('reference-tile-link'); + expect(links).toHaveLength(0); - it('allows navigation on simple click (no drag)', () => { - render(); - - const firstLink = screen.getAllByTestId('reference-tile-link')[0]; - - // Simulate simple click sequence - fireEvent.mouseDown(firstLink, { pageX: 100, clientX: 100 }); - fireEvent.mouseUp(firstLink); - const clickEvent = new MouseEvent('click', { bubbles: true, cancelable: true }); - - firstLink.dispatchEvent(clickEvent); - - expect(clickEvent.defaultPrevented).toBe(false); - }); - - it('prevents navigation if mouse was dragged', () => { - render(); - - const firstLink = screen.getAllByTestId('reference-tile-link')[0]; - - // Simulate drag sequence - fireEvent.mouseDown(firstLink, { pageX: 100, clientX: 100 }); - // Simulate mouse move of 20px - fireEvent.mouseMove(firstLink, { pageX: 120, clientX: 120 }); - fireEvent.mouseUp(firstLink); - - const clickEvent = new MouseEvent('click', { bubbles: true, cancelable: true }); - firstLink.dispatchEvent(clickEvent); - - expect(clickEvent.defaultPrevented).toBe(true); + const tiles = screen.getAllByTestId('reference-tile'); + expect(tiles).toHaveLength(2); }); }); diff --git a/components/blocks/ReferencesSlider.tsx b/components/blocks/ReferencesSlider.tsx index b1cf00a27..d09c97463 100644 --- a/components/blocks/ReferencesSlider.tsx +++ b/components/blocks/ReferencesSlider.tsx @@ -92,11 +92,6 @@ export function ReferencesSlider(props: ReferencesSliderProps) { dragDistanceRef.current = Math.abs(x - startXRef.current); }; - const handleTileClick = (e: React.MouseEvent) => { - if (dragDistanceRef.current > 10) { - e.preventDefault(); - } - }; return (
@@ -135,10 +130,8 @@ export function ReferencesSlider(props: ReferencesSliderProps) { transition={{ delay: i * 0.1, duration: 0.6, ease: "easeOut" }} className="flex-shrink-0 w-[320px] md:w-[480px] snap-center group pointer-events-auto" > -

{ref.title}

- +
); })} diff --git a/content/de/home.mdx b/content/de/home.mdx index 4c1532ab1..fbacb8f60 100644 --- a/content/de/home.mdx +++ b/content/de/home.mdx @@ -39,6 +39,7 @@ description: "Die E-TIB GmbH ist Ihr zuverlässiger Partner für komplexe Kabelt title: "E-TIB Bohrtechnik GmbH", description: "Präzise Horizontalspülbohrungen in allen Bodenklassen für eine oberflächenschonende und grabenlose Leitungsverlegung.", icon: "M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z", + url: "/de/bohrtechnik", backgroundImage: "/assets/photos/DSC08653.JPG" } ]} diff --git a/content/en/home.mdx b/content/en/home.mdx index 2e76c0683..3c07d53ed 100644 --- a/content/en/home.mdx +++ b/content/en/home.mdx @@ -39,6 +39,7 @@ description: "E-TIB GmbH is your reliable partner for complex cable routes, hori title: "E-TIB Bohrtechnik GmbH", description: "Precise horizontal directional drilling in all soil classes for surface-friendly and trenchless pipe laying.", icon: "M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z", + url: "/en/drilling-technology", backgroundImage: "/assets/photos/DSC08653.JPG" } ]} diff --git a/lib/map-data.ts b/lib/map-data.ts index 081c0288d..964817c5b 100644 --- a/lib/map-data.ts +++ b/lib/map-data.ts @@ -45,7 +45,6 @@ export const defaultLocations: Location[] = [ x: 66.38, y: 14.04, description: 'Netzanbindung Solarpark', - href: '/referenzen/dettmannsdorf', }, { id: 'proetzel', @@ -54,7 +53,6 @@ export const defaultLocations: Location[] = [ x: 78.84, y: 32.5, description: 'Kabeltrasse Solarpark', - href: '/referenzen/proetzel', }, { id: 'ostbevern', @@ -63,7 +61,6 @@ export const defaultLocations: Location[] = [ x: 26.64, y: 39.84, description: 'Netzanbindung Windpark', - href: '/referenzen/ostbevern', }, { id: 'petershagen', @@ -72,7 +69,6 @@ export const defaultLocations: Location[] = [ x: 36.26, y: 35.79, description: 'Netzanbindung Windpark', - href: '/referenzen/petershagen', }, { id: 'ketzin', @@ -81,7 +77,6 @@ export const defaultLocations: Location[] = [ x: 72, y: 34, description: 'Netzanbindung Windpark', - href: '/referenzen/ketzin', }, { id: 'jevenstedt', @@ -90,7 +85,6 @@ export const defaultLocations: Location[] = [ x: 43, y: 9, description: 'Netzanbindung Windpark', - href: '/referenzen/jevenstedt', } ]; diff --git a/tests/task-12-links.test.ts b/tests/task-12-links.test.ts new file mode 100644 index 000000000..25f36c50b --- /dev/null +++ b/tests/task-12-links.test.ts @@ -0,0 +1,38 @@ +import { describe, it, expect } from 'vitest'; +import fs from 'fs'; +import path from 'path'; +import { defaultLocations } from '../lib/map-data'; + +describe('Task 12 TDD - Bohrtechnik and Reference Links', () => { + const deHomePath = path.join(process.cwd(), 'content', 'de', 'home.mdx'); + const enHomePath = path.join(process.cwd(), 'content', 'en', 'home.mdx'); + + it('should verify E-TIB Bohrtechnik GmbH has the correct page link in DE and EN home.mdx', () => { + const deContent = fs.readFileSync(deHomePath, 'utf8'); + const enContent = fs.readFileSync(enHomePath, 'utf8'); + + // Assert that E-TIB Bohrtechnik GmbH has url: "/de/bohrtechnik" in German content + expect(deContent).toContain('title: "E-TIB Bohrtechnik GmbH"'); + // We expect it to have the url parameter added + const bohrtechnikDeBlock = deContent.substring(deContent.indexOf('title: "E-TIB Bohrtechnik GmbH"')); + const urlDeIndex = bohrtechnikDeBlock.indexOf('url:'); + const nextItemDeIndex = bohrtechnikDeBlock.indexOf('title:', 10); + + // Ensure "url:" exists within the E-TIB Bohrtechnik block and points to "/de/bohrtechnik" + expect(deContent).toMatch(/title:\s*"E-TIB Bohrtechnik GmbH"[\s\S]*?url:\s*["']\/de\/bohrtechnik["']/); + + // Assert that E-TIB Bohrtechnik GmbH has url: "/en/drilling-technology" in English content + expect(enContent).toContain('title: "E-TIB Bohrtechnik GmbH"'); + expect(enContent).toMatch(/title:\s*"E-TIB Bohrtechnik GmbH"[\s\S]*?url:\s*["']\/en\/drilling-technology["']/); + }); + + it('should verify that all reference projects in map-data have no href links', () => { + // Check that all defaultLocations of type 'project' have href undefined or removed + const projects = defaultLocations.filter(loc => loc.type === 'project'); + expect(projects.length).toBeGreaterThan(0); + + projects.forEach(project => { + expect(project.href).toBeUndefined(); + }); + }); +});