From c4a85d3dc8745cfbb951111d81839698e4e493bd Mon Sep 17 00:00:00 2001 From: Application-drop-up Date: Tue, 19 May 2026 10:05:47 +0900 Subject: [PATCH] chore(search): delete SearchResultMapComponent.tsx [closes #363] Co-Authored-By: Claude Sonnet 4.6 --- .../components/SearchResultMapComponent.tsx | 81 ------------------- 1 file changed, 81 deletions(-) delete mode 100644 client/src/app/features/search/components/SearchResultMapComponent.tsx 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}
-
-
- ))} -
-
- ); -}