Skip to content

refactor(Home): 홈 페이지 로직 분리#57

Open
crohasang wants to merge 2 commits intodevelopfrom
COV-76/refactor_home
Open

refactor(Home): 홈 페이지 로직 분리#57
crohasang wants to merge 2 commits intodevelopfrom
COV-76/refactor_home

Conversation

@crohasang
Copy link
Contributor

요약

이슈 번호 : #76

변경 사항

  • pages/Home에 index.tsx를 components, hooks, types, utils로 분리
  • components에는 CompanionSection, DateSection, LocatiionSection, PlacesSection 파일이 존재

리뷰 요구사항

  • 테스트 결과 정상적으로 작동하는 건 확인했지만, 혹시 이 리팩토링 방식이 어떤지에 대한 의견이 어떤지 듣고 싶습니다.

확인 방법 (선택)



📌 PR 진행 시 이러한 점들을 참고해 주세요

* P1 : 꼭 반영해 주세요 (Request Changes) - 이슈가 발생하거나 취약점이 발견되는 케이스 등
* P2 : 반영을 적극적으로 고려해 주시면 좋을 것 같아요 (Comment)
* P3 : 이런 방법도 있을 것 같아요~ 등의 사소한 의견입니다 (Chore)

- pages/Home에 index.tsx를 components, hooks, types, utils로 분리
- components에는 CompanionSection, DateSection, LocatiionSection, PlacesSection 파일이 존재
Copy link
Member

@hyunn522 hyunn522 left a comment

Choose a reason for hiding this comment

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

훨씬 깔끔해졌네요~
디렉토리 구조는 정했던 컨벤션과는 다르게 pages 내에서 component와 hook, util을 처리하신 것 같은데 어떤 이유에서일까요?

Comment on lines +3 to +18
export interface RecommendationRequest {
GUNGU: string;
LONGITUDE: number;
LATITUDE: number;
RADIUS: number;
AGE_GRP: string;
GENDER: string;
TRAVEL_STYL_1: string;
TRAVEL_STYL_2: string;
TRAVEL_STYL_3: string;
TRAVEL_STYL_4: string;
TRAVEL_STYL_5: string;
TRAVEL_STYL_6: string;
TRAVEL_STATUS_ACCOMPANY: string;
VISIT_AREA_TYPE_CD: string;
}
Copy link
Member

Choose a reason for hiding this comment

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

API 호출 시 recommend request를 위한 타입이 존재할 것 같은데, 어떤 차이점이 있나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

디렉토리 구조는 정했던 컨벤션과는 다르게 pages 내에서 component와 hook, util을 처리하신 것 같은데 어떤 이유에서일까요?
-> 원래 pages 내에 있는 파일을 분리하다보니, 헷갈리지 않기 위해서 해당 폴더 내에서 분리했습니다. 또한, 해당 페이지 내에서만 사용되는 hook과 util이므로 해당 폴더 안에 존재해도 괜찮겠다고 판단했습니다.

API 호출 시 recommend request를 위한 타입이 존재할 것 같은데, 어떤 차이점이 있나요?
-> AI 서버와 연동 전 제가 임시로 타입을 설정해서 개발을 진행했었는데, 연결을 하려고 할 때 제가 생각했던 타입과 차이가 나서 recommend request 타입을 any로 설정하고 개발을 진행했었습니다.

위의 해당 RecommendationRequest는 src/Home/utils.ts에서는 사용되었지만, src/api/recommendation.ts의 fetchRecommendations 메서드에서는 사용되지 않았습니다(타입을 any로 지정했습니다).

Copy link
Member

Choose a reason for hiding this comment

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

아하 그러면 pages 외부와 내부의 폴더 구분 기준을 명확하게 두면 좋을 것 같아요~
any 타입 지정 시 build error가 나서 any 타입은 수정 부탁드려요

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.

2 participants