Compare commits
2 Commits
v2.2.13-rc
...
v2.2.13-rc
| Author | SHA1 | Date | |
|---|---|---|---|
| e677089ff9 | |||
| b7d9a4b0d0 |
@@ -1,6 +1,6 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import React, { useState } from 'react';
|
import React, { useState, useRef } from 'react';
|
||||||
import { motion, AnimatePresence } from 'framer-motion';
|
import { motion, AnimatePresence } from 'framer-motion';
|
||||||
import { MapPin, Factory, Zap, CheckCircle2, ArrowUpRight } from 'lucide-react';
|
import { MapPin, Factory, Zap, CheckCircle2, ArrowUpRight } from 'lucide-react';
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
@@ -38,10 +38,13 @@ export function InteractiveGermanyMap({
|
|||||||
hideStandorte = false
|
hideStandorte = false
|
||||||
}: InteractiveGermanyMapProps) {
|
}: InteractiveGermanyMapProps) {
|
||||||
const [activeLocation, setActiveLocation] = useState<Location | null>(null);
|
const [activeLocation, setActiveLocation] = useState<Location | null>(null);
|
||||||
const [hoverTimeout, setHoverTimeout] = useState<NodeJS.Timeout | null>(null);
|
const hoverTimeoutRef = useRef<NodeJS.Timeout | null>(null);
|
||||||
|
|
||||||
const handleMouseEnter = (loc: Location) => {
|
const handleMouseEnter = (loc: Location) => {
|
||||||
if (hoverTimeout) clearTimeout(hoverTimeout);
|
if (hoverTimeoutRef.current) {
|
||||||
|
clearTimeout(hoverTimeoutRef.current);
|
||||||
|
hoverTimeoutRef.current = null;
|
||||||
|
}
|
||||||
setActiveLocation(loc);
|
setActiveLocation(loc);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -49,7 +52,7 @@ export function InteractiveGermanyMap({
|
|||||||
const timeout = setTimeout(() => {
|
const timeout = setTimeout(() => {
|
||||||
setActiveLocation(null);
|
setActiveLocation(null);
|
||||||
}, 200);
|
}, 200);
|
||||||
setHoverTimeout(timeout);
|
hoverTimeoutRef.current = timeout;
|
||||||
};
|
};
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { describe, it, expect } from 'vitest';
|
import { describe, it, expect } from 'vitest';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { defaultLocations } from '../lib/map-data';
|
import { defaultLocations, minorLocations } from '../lib/map-data';
|
||||||
|
|
||||||
describe('Task 12 TDD - Bohrtechnik and Reference Links', () => {
|
describe('Task 12 TDD - Bohrtechnik and Reference Links', () => {
|
||||||
const deHomePath = path.join(process.cwd(), 'content', 'de', 'home.mdx');
|
const deHomePath = path.join(process.cwd(), 'content', 'de', 'home.mdx');
|
||||||
@@ -27,10 +27,11 @@ describe('Task 12 TDD - Bohrtechnik and Reference Links', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should verify that all reference projects in map-data have no href links', () => {
|
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
|
// Check that all minorLocations of type 'minor_node' have href undefined
|
||||||
const projects = defaultLocations.filter(loc => loc.type === 'project');
|
// since all projects were downgraded to minor nodes without links.
|
||||||
|
const projects = minorLocations.filter(loc => loc.type === 'minor_node');
|
||||||
expect(projects.length).toBeGreaterThan(0);
|
expect(projects.length).toBeGreaterThan(0);
|
||||||
|
|
||||||
projects.forEach(project => {
|
projects.forEach(project => {
|
||||||
expect(project.href).toBeUndefined();
|
expect(project.href).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user