Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d9c8966
feat: react-daum-postcode 패키지 추가
Dobbymin Aug 22, 2025
f82425e
feat: 주소 타입 정의 추가
Dobbymin Aug 22, 2025
d530ceb
feat: 주소 검색 훅(useAddressSearch) 구현
Dobbymin Aug 22, 2025
5d43daf
feat: 주소 입력 필드에 주소 검색 기능 추가 및 UI 개선
Dobbymin Aug 22, 2025
3ce6ee9
feat: 장소 검색 API 추가
Dobbymin Aug 22, 2025
3608876
feat: 장소 검색 훅(useGetSearchPlace) 추가
Dobbymin Aug 22, 2025
1281a17
feat: 장소 검색 타입 정의 추가
Dobbymin Aug 22, 2025
633ee61
feat: zustand 패키지 추가
Dobbymin Aug 22, 2025
16327a3
feat: 장소 검색 API 제거 및 훅 추가
Dobbymin Aug 22, 2025
ca5712d
feat: 장소 검색 훅(useGetSearchPlace) 제거 및 카카오 주소 검색 훅(useKakaoAddressSear…
Dobbymin Aug 22, 2025
db58c09
feat: 맵 관련 타입 및 모듈 추가
Dobbymin Aug 22, 2025
1b9f66c
feat: 스피너 컴포넌트 추가 및 UI 인덱스에 내보내기 추가
Dobbymin Aug 22, 2025
3ae3007
feat: 카카오 맵 컴포넌트 추가 및 맵 관련 유틸리티와 UI 내보내기 추가
Dobbymin Aug 22, 2025
4959675
feat: 기본 맵 값 상수 추가
Dobbymin Aug 22, 2025
e497c3c
feat: 카카오맵 API를 활용한 주소 검색 유틸리티 및 타입 정의 추가
Dobbymin Aug 22, 2025
37e16dd
feat: 주소 상태 관리 훅(useMapAddress) 및 인덱스 파일 추가
Dobbymin Aug 22, 2025
0be8b3d
fix: 주소 검색 유틸리티의 import 경로 수정
Dobbymin Aug 22, 2025
076554b
feat: 카카오맵 관련 컴포넌트
Dobbymin Aug 22, 2025
96b3238
refactor: 카카오 로그인 훅에서 주석 제거 및 코드 정리
Dobbymin Aug 22, 2025
c6e62ed
feat: 지도 컴포넌트에서 주소 상태 관리 훅을 사용하여 위도 및 경도 동적 설정
Dobbymin Aug 22, 2025
c28e790
feat: 주소 검색 기능에 카카오맵 API 연동 및 지도 아이콘 추가
Dobbymin Aug 22, 2025
28a3194
fix: MainPage에서 LandlordReliabilitySection의 위치 변경
Dobbymin Aug 22, 2025
983d4ec
fix: MainPage에서 LandlordPropertySection의 위치 변경
Dobbymin Aug 22, 2025
7854985
fix: KakaoMap 컴포넌트에서 오류 메시지 표시 방식 변경 및 불필요한 주석 제거
Dobbymin Aug 22, 2025
aed4b01
fix: 주소 검색 훅에서 모달 열림 상태에 따라 문서의 스크롤 잠금 및 해제 기능 추가
Dobbymin Aug 22, 2025
9cf7686
fix: 주소 검색 훅에서 예외 처리 추가 및 오류 메시지 로깅 기능 구현
Dobbymin Aug 22, 2025
514039d
feat: @radix-ui/react-dialog 패키지 추가 및 pnpm-lock.yaml 업데이트
Dobbymin Aug 22, 2025
f650f3f
feat: Dialog 컴포넌트 추가 및 Radix UI Dialog 구성 요소 통합
Dobbymin Aug 22, 2025
e1f84a4
fix: Dialog 컴포넌트의 닫기 버튼 스타일 수정 및 크기 조정
Dobbymin Aug 22, 2025
485923c
feat: 주소 검색 기능을 Dialog 컴포넌트로 변경하여 UI 개선
Dobbymin Aug 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@hookform/resolvers": "^5.2.1",
"@radix-ui/react-avatar": "^1.1.10",
"@radix-ui/react-checkbox": "^1.3.3",
"@radix-ui/react-dialog": "^1.1.15",
"@radix-ui/react-label": "^2.1.7",
"@radix-ui/react-radio-group": "^1.3.8",
"@radix-ui/react-select": "^2.2.6",
Expand All @@ -37,6 +38,7 @@
"next-themes": "^0.4.6",
"prettier": "^3.6.2",
"react": "^19.1.1",
"react-daum-postcode": "^3.2.0",
"react-dom": "^19.1.1",
"react-hook-form": "^7.62.0",
"react-kakao-maps-sdk": "^1.2.0",
Expand All @@ -46,7 +48,8 @@
"tailwind-merge": "^3.3.1",
"tailwind-scrollbar-hide": "^4.0.0",
"tailwindcss": "^4.1.12",
"zod": "^4.0.17"
"zod": "^4.0.17",
"zustand": "^5.0.8"
},
"devDependencies": {
"@eslint/js": "^9.33.0",
Expand Down
78 changes: 78 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions src/entities/auth/hooks/useKakaoLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ import { BASE_URL } from '@/shared';

import { getTicketApi } from '../apis';

// --- 1. "로그인 시작"을 위한 useMutation ---
// 이 훅은 API를 호출하지 않아. 오직 카카오 로그인 페이지로 '이동'시키는 액션만 책임져.
export const useKakaoLogin = () => {
return useMutation({
mutationFn: () => {
// 실제로는 Promise를 반환할 필요는 없지만, mutationFn은 Promise를 기대해.
window.location.href = `${BASE_URL}/oauth2/authorization/kakao`;
return Promise.resolve();
},
Expand All @@ -20,17 +17,14 @@ export const useKakaoLogin = () => {
});
};

// --- 2. "콜백 처리"를 위한 useQuery ---
export const KakaoCallbackQueryKey = {
callback: (ticket: string) => ['kakaoCallback', ticket],
};

export const useKakaoCallback = (ticket: string) => {
return useQuery({
queryKey: KakaoCallbackQueryKey.callback(ticket),
// code가 있을 때만 이 쿼리를 실행해.
queryFn: () => getTicketApi(ticket),
// 이 쿼리는 한 번만 실행되면 되므로, 재시도나 캐시 관련 옵션을 조정할 수 있어.
retry: 0,
staleTime: Infinity,
});
Expand Down
1 change: 1 addition & 0 deletions src/entities/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './auth';
export * from './chart';
export * from './map';
3 changes: 3 additions & 0 deletions src/entities/map/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './types';
export * from './utils';
export * from './ui';
1 change: 1 addition & 0 deletions src/entities/map/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './map.type';
5 changes: 5 additions & 0 deletions src/entities/map/types/map.type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export type MapAddress = {
address: string;
latitude: number;
longitude: number;
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Map, MapMarker, useKakaoLoader } from 'react-kakao-maps-sdk';

import { Spinner } from '@/shared';

type Props = {
lat: number;
lng: number;
Expand All @@ -16,16 +18,12 @@ export const KakaoMap = ({ lat, lng }: Props) => {
lng: lng,
};

if (loading) return <div>Loading...</div>;
if (error) return <div>Error: {error.message}</div>;
if (loading) return <Spinner />;

if (error) return <div>오류 : {error.message}</div>;

return (
<Map // 지도를 표시할 Container
id='map'
center={center}
className='h-full w-full'
level={3} // 지도의 확대 레벨
>
<Map id='map' center={center} className='h-full w-full' level={3}>
<MapMarker position={center} />
</Map>
);
Expand Down
1 change: 1 addition & 0 deletions src/entities/map/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './search-coordinates';
114 changes: 114 additions & 0 deletions src/entities/map/utils/search-coordinates.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
// 카카오맵 API 타입 정의
declare global {
interface Window {
kakao: {
maps: {
services: {
Geocoder: new () => {
addressSearch: (
address: string,
callback: (result: KakaoGeocoderResult[], status: string) => void,
) => void;
};
};
};
};
}
}

export interface KakaoGeocoderResult {
address: {
address_name: string;
b_code: string;
h_code: string;
main_address_no: string;
mountain_yn: string;
region_1depth_name: string;
region_2depth_name: string;
region_3depth_h_name: string;
region_3depth_name: string;
sub_address_no: string;
x: string;
y: string;
};
road_address: {
address_name: string;
building_name: string;
main_building_no: string;
region_1depth_name: string;
region_2depth_name: string;
region_3depth_name: string;
road_name: string;
sub_building_no: string;
underground_yn: string;
x: string;
y: string;
zone_no: string;
} | null;
x: string; // 경도
y: string; // 위도
}

export interface AddressSearchResult {
success: boolean;
data?: {
address: string;
latitude: number;
longitude: number;
};
error?: string;
}

/**
* 카카오맵 API를 사용하여 주소를 좌표로 변환하는 함수
* @param address 검색할 주소
* @returns Promise<AddressSearchResult>
*/
export const searchAddressToCoordinates = (address: string): Promise<AddressSearchResult> => {
return new Promise((resolve) => {
// 카카오맵 API가 로드되지 않은 경우
if (!window.kakao?.maps?.services?.Geocoder) {
resolve({
success: false,
error: '카카오맵 API가 로드되지 않았습니다.',
});
return;
}

const geocoder = new window.kakao.maps.services.Geocoder();

geocoder.addressSearch(address, (result: KakaoGeocoderResult[], status: string) => {
if (status === 'OK' && result.length > 0) {
const firstResult = result[0];
const addressInfo = firstResult.road_address || firstResult.address;

resolve({
success: true,
data: {
address: addressInfo.address_name,
latitude: parseFloat(firstResult.y),
longitude: parseFloat(firstResult.x),
},
});
} else if (status === 'ZERO_RESULT') {
resolve({
success: false,
error: '검색 결과가 없습니다.',
});
} else {
resolve({
success: false,
error: `검색 중 오류가 발생했습니다: ${status}`,
});
}
});
});
};

/**
* 카카오맵 API 스크립트가 로드되었는지 확인하는 함수
* @returns boolean
*/
export const isKakaoMapLoaded = (): boolean => {
return !!window.kakao?.maps?.services?.Geocoder;
};
Loading
Loading