Skip to content

[기능 구현] 카카오맵 API를 활용한 지도 표시 기능 구현#44

Merged
Dobbymin merged 6 commits intomainfrom
feat#39-kakao
Aug 21, 2025
Merged

[기능 구현] 카카오맵 API를 활용한 지도 표시 기능 구현#44
Dobbymin merged 6 commits intomainfrom
feat#39-kakao

Conversation

@Dobbymin
Copy link
Copy Markdown
Contributor

📝 요약 (Summary)

카카오맵 API를 활용한 지도 표시 기능을 구현하여 사용자가 매물 위치를 시각적으로 확인할 수 있도록 했습니다.

✅ 주요 변경 사항 (Key Changes)

  • 카카오맵 컴포넌트 생성 및 내보내기 설정
  • MapSection에 카카오맵 컴포넌트 통합
  • 카카오맵 API 키 환경 변수 설정
  • TypeScript 타입 정의 파일 추가
  • react-kakao-maps-sdk 패키지 설치
  • 환경 변수 파일(.env)을 .gitignore에 추가

💻 상세 구현 내용 (Implementation Details)

카카오맵 컴포넌트 구현

  • shared/components/features/kakao-map/KakaoMap.tsx 컴포넌트를 생성하여 카카오맵 렌더링 기능 구현
  • shared/components/features/kakao-map/index.ts에서 컴포넌트를 내보내도록 설정하여 다른 모듈에서 쉽게 import할 수 있도록 함

MapSection 통합

  • features/main/ui/MapSection.tsx에 카카오맵 컴포넌트를 추가하여 실제 지도 표시 기능 구현
  • 사용자가 매물의 위치를 지도에서 직접 확인할 수 있는 UI 제공

개발 환경 설정

  • .env 파일에 VITE_KAKAOMAP_API_KEY 환경 변수 추가로 API 키 관리
  • tsconfig.jsonkakao.maps.d.ts 타입 정의 파일 경로 추가하여 TypeScript 지원
  • react-kakao-maps-sdk 패키지 설치로 React 환경에서 카카오맵 사용 가능
  • .gitignore.env 파일 추가로 민감한 API 키 정보 보호

🚀 트러블 슈팅 (Trouble Shooting)

  • 카카오맵 API 키를 환경 변수로 관리하여 보안성 확보
  • TypeScript 타입 정의를 추가하여 개발 시 타입 안정성 보장
  • 패키지 설치 및 설정 과정에서 발생할 수 있는 의존성 문제를 사전에 해결

⚠️ 알려진 이슈 및 참고 사항 (Known Issues & Notes)

  • 카카오맵 API 키가 필요하므로 배포 환경에서 환경 변수 설정이 필요합니다
  • 카카오맵 컴포넌트의 초기 로딩 성능 최적화가 필요할 수 있습니다
  • 지도 표시 시 반응형 디자인 적용이 필요할 수 있습니다

📸 스크린샷 (Screenshots)

[지도 표시 기능 스크린샷을 여기에 추가해주세요]

#️⃣ 관련 이슈 (Related Issues)

@Dobbymin Dobbymin linked an issue Aug 21, 2025 that may be closed by this pull request
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @Dobbymin, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 카카오맵 API를 활용하여 매물 위치를 시각적으로 표시하는 기능을 구현합니다. 새로운 카카오맵 컴포넌트를 생성하고, 이를 기존 MapSection에 통합하며, API 키를 환경 변수로 설정하고, TypeScript 타입 정의를 추가하는 등의 작업을 포함합니다.

Highlights

  • 카카오맵 컴포넌트 생성: 재사용 가능한 KakaoMap 컴포넌트를 생성하여 지도 렌더링 기능을 구현했습니다.
  • 지도 섹션 통합: MapSection.tsx 파일에 KakaoMap 컴포넌트를 통합하여 실제 매물 위치를 지도에 표시할 수 있도록 했습니다.
  • 환경 변수 설정: 카카오맵 API 키를 VITE_KAKAOMAP_API_KEY 환경 변수로 관리하도록 설정하고, .gitignore에 추가하여 보안을 강화했습니다.
  • TypeScript 타입 지원: kakao.maps.d.ts 타입 정의 파일을 tsconfig.json에 추가하여 카카오맵 관련 코드의 타입 안정성을 확보했습니다.
  • 패키지 설치: react-kakao-maps-sdk 패키지를 설치하여 React 환경에서 카카오맵을 쉽게 사용할 수 있도록 했습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@Dobbymin Dobbymin self-assigned this Aug 21, 2025
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

카카오맵 API를 활용한 지도 표시 기능 구현을 위한 PR 잘 보았습니다. 전반적으로 기능 구현이 잘 이루어졌으며, 환경 변수를 사용하여 API 키를 안전하게 관리하고, 컴포넌트 구조를 잘 분리한 점이 좋습니다. 다만, 코드의 유지보수성과 성능을 더욱 향상시키기 위해 몇 가지 개선점을 제안합니다. 하드코딩된 값들을 상수로 추출하고, 불필요한 라이브러리 로드를 줄이며, 로딩 및 에러 상태에 대한 UI를 개선하는 것을 고려해볼 수 있습니다. 또한, tsconfig.json 설정에 중복된 부분이 있어 정리하면 좋을 것 같습니다. 자세한 내용은 각 파일에 남긴 코멘트를 참고해주세요.

<p className='mb-2 text-lg font-medium'>지도가 여기에 표시됩니다</p>
<p className='text-sm'>주소를 입력하고 진단하기를 눌러보세요</p>
</div>
<KakaoMap lat={35.1690637154991} lng={129.136018268316} />
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

지도에 표시될 기본 위도와 경도 값이 하드코딩되어 있습니다. 이러한 '매직 넘버'는 코드의 가독성과 유지보수성을 저해할 수 있습니다. 이 값들을 src/features/main/constants.ts와 같은 파일에 DEFAULT_MAP_CENTER 상수로 정의하고, KakaoMap 컴포넌트에 props를 넘길 때 스프레드 연산자를 사용하면 더 간결해집니다.

Suggested change
<KakaoMap lat={35.1690637154991} lng={129.136018268316} />
<KakaoMap {...DEFAULT_MAP_CENTER} />

Comment on lines +9 to +12
const [loading, error] = useKakaoLoader({
appkey: import.meta.env.VITE_KAKAOMAP_API_KEY,
libraries: ['clusterer', 'drawing', 'services'],
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

useKakaoLoader를 통해 카카오맵 라이브러리를 불러올 때 clusterer, drawing, services를 모두 포함하고 있습니다. 현재 구현에서는 마커 표시 기능만 사용되므로, 이 라이브러리들이 당장 필요하지 않다면 제거하여 초기 로딩 성능을 개선하는 것을 고려해볼 수 있습니다. 불필요한 라이브러리를 로드하면 초기 로딩 시간이 길어질 수 있습니다. 필요한 시점에 동적으로 로드하거나, 실제로 사용될 때 추가하는 것이 좋습니다.

  const [loading, error] = useKakaoLoader({
    appkey: import.meta.env.VITE_KAKAOMAP_API_KEY,
  });

Comment on lines +14 to +17
const center = {
lat: lat,
lng: lng,
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

객체의 키와 값으로 사용되는 변수명이 같을 경우, ES6의 속성 축약 표현(property shorthand)을 사용하여 코드를 더 간결하게 만들 수 있습니다.

  const center = {
    lat,
    lng,
  };

Comment on lines +19 to +20
if (loading) return <div>Loading...</div>;
if (error) return <div>Error: {error.message}</div>;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

로딩 및 에러 상태를 간단한 div 태그로 처리하고 있습니다. 사용자 경험(UX)과 UI 일관성을 위해 프로젝트 내에 공용으로 사용하는 SpinnerError 컴포넌트가 있다면 그것을 활용하는 것이 좋습니다. 예를 들어, 로딩 중에는 스피너를 보여주고, 에러 발생 시에는 사용자에게 친화적인 메시지와 함께 재시도 옵션을 제공하는 등의 개선을 고려해볼 수 있습니다.

id='map'
center={center}
className='h-full w-full'
level={3} // 지도의 확대 레벨
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

지도의 확대 레벨(level) 값으로 3이 하드코딩되어 있습니다. 이 값의 의미를 명확히 하고 유지보수를 용이하게 하기 위해 DEFAULT_MAP_LEVEL과 같은 이름의 상수로 정의하여 사용하는 것을 권장합니다.

      level={DEFAULT_MAP_LEVEL} // 지도의 확대 레벨

@Dobbymin Dobbymin merged commit bd21c30 into main Aug 21, 2025
1 of 2 checks passed
@Dobbymin Dobbymin deleted the feat#39-kakao branch August 21, 2025 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[기능 구현] map 라이브러리 추가

1 participant