diff --git a/client/src/app/features/search/components/SearchResultMapComponent.tsx b/client/src/app/features/search/components/SearchResultMapComponent.tsx deleted file mode 100644 index 74b00e5..0000000 --- a/client/src/app/features/search/components/SearchResultMapComponent.tsx +++ /dev/null @@ -1,81 +0,0 @@ -import { MapContainer, TileLayer, CircleMarker, Tooltip, useMap } from "react-leaflet"; -import { useNavigate } from "react-router-dom"; -import type { WorldHeritageVm } from "../../../../domain/types.ts"; -import "leaflet/dist/leaflet.css"; -import { useEffect } from "react"; -import type { LatLngBoundsExpression } from "leaflet"; - -const CATEGORY_COLOR: Record = { - Cultural: "#f59e0b", - Natural: "#22c55e", - Mixed: "#ef4444", -}; - -const getColor = (category: string): string => CATEGORY_COLOR[category] ?? "#6366f1"; - -const isValidCoordinate = (lat: number | null, lng: number | null): lat is number => - lat !== null && lng !== null && lat !== 0 && lng !== 0; - -function FitBounds({ items }: { items: WorldHeritageVm[] }) { - const map = useMap(); - - useEffect(() => { - if (items.length === 0) return; - - const bounds: LatLngBoundsExpression = items.map((item) => [ - item.latitude as number, - item.longitude as number, - ]); - - map.fitBounds(bounds, { padding: [40, 40], maxZoom: 5 }); - }, [items, map]); - - return null; -} - -export function SearchResultMapComponent({ items }: { items: WorldHeritageVm[] }) { - const navigate = useNavigate(); - - const validItems = items.filter((item) => isValidCoordinate(item.latitude, item.longitude)); - - if (validItems.length === 0) { - return null; - } - - return ( -
- - - - {validItems.map((item) => ( - navigate(`/heritages/${item.id}`), - }} - > - -
{item.name}
-
{item.category}
-
-
- ))} -
-
- ); -} diff --git a/client/src/app/features/search/components/SearchResultsPage.tsx b/client/src/app/features/search/components/SearchResultsPage.tsx index 5915e8f..54f83bf 100644 --- a/client/src/app/features/search/components/SearchResultsPage.tsx +++ b/client/src/app/features/search/components/SearchResultsPage.tsx @@ -6,7 +6,6 @@ import type { import { HeritageCard } from "@features/top/cards/HeritageCard"; import { Pagination } from "@features/top/components/Pagination.tsx"; import { BreadcrumbList } from "@shared/components/BreadcrumbList.tsx"; -import { SearchResultMapComponent } from "@features/search/components/SearchResultMapComponent.tsx"; import { LocaleToggle } from "@shared/locale/LocaleToggle.tsx"; import { useText } from "@shared/locale/ui-text.ts"; @@ -87,8 +86,6 @@ export default function SearchResultsPage({
- - {items.length === 0 ? (

{text.noSitesFound}