diff --git a/src/app/village/[id]/page.tsx b/src/app/village/[id]/page.tsx
index e98ecdd..80ae66c 100644
--- a/src/app/village/[id]/page.tsx
+++ b/src/app/village/[id]/page.tsx
@@ -49,11 +49,17 @@ const Page = async ({ params }: { params: { id: number } }) => {
-
+
-
-
+
+
diff --git a/src/app/village/page.tsx b/src/app/village/page.tsx
index 65cab7f..8a6be76 100644
--- a/src/app/village/page.tsx
+++ b/src/app/village/page.tsx
@@ -49,7 +49,7 @@ const Page = () => {
지도에서 보는 마을
-
+
{villages.slice(3).map((filteredItem) => (
diff --git a/src/components/KakaoMap.tsx b/src/components/KakaoMap.tsx
index 0879b0b..09f05c8 100644
--- a/src/components/KakaoMap.tsx
+++ b/src/components/KakaoMap.tsx
@@ -22,13 +22,15 @@ interface KakaoMapProps {
initialLon: number;
level: number;
villages: Village[];
+ isMarkerClicked?: boolean;
}
-const KakaoMap = ({ villages, initialLat, initialLon, level }: KakaoMapProps) => {
+const KakaoMap = ({ villages, initialLat, initialLon, level, isMarkerClicked = false }: KakaoMapProps) => {
useEffect(() => {
const initializeMap = () => {
const container = document.getElementById('map');
if (!container) {
+ console.error('Map container not found');
return;
}
@@ -58,7 +60,9 @@ const KakaoMap = ({ villages, initialLat, initialLon, level }: KakaoMapProps) =>
});
window.kakao.maps.event.addListener(marker, 'click', () => {
- window.location.href = `/village/${village.id}`;
+ if (isMarkerClicked) {
+ window.location.href = `/village/${village.id}`;
+ }
});
});
};
@@ -77,15 +81,19 @@ const KakaoMap = ({ villages, initialLat, initialLon, level }: KakaoMapProps) =>
window.kakao.maps.load(() => {
initializeMap();
});
+ } else {
+ console.error('Kakao maps load function is not available');
}
};
- script.onerror = () => {};
+ script.onerror = () => {
+ console.error('Failed to load Kakao Maps script');
+ };
document.head.appendChild(script);
};
loadKakaoMap();
- }, [villages]);
+ }, [villages, initialLat, initialLon, level, isMarkerClicked]);
return (