Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: 마이리스트, 콜라보리스트 페이지 api 연동 #21

Merged
merged 25 commits into from
Feb 8, 2024

Conversation

ParkSohyunee
Copy link
Contributor

개요

  • 마이리스트, 콜라보리스트 페이지 관련 api를 연동했습니다.
  • url path 변경에 따른 폴더구조를 변경했습니다.
  • 확정된 피그마를 바탕으로 layout을 수정했습니다.

작업 사항

  • mock data 삭제
  • profile 조회 / category 조회 / list 조회 api 연동
  • 카테고리 선택에 따른 list 조회 기능 구현
  • [userNickname]폴더를 [userId]폴더로 변경 및 변경에 따른 일부 로직 수정
  • 피그마 바탕으로 전체적인 layout 수정(top 베젤, card 패딩, 프로필 margin 등)
  • 페이지 이동 라우터 커스텀 훅 생성

참고 사항 (optional)

  • 해당 페이지 관련하여 다음과 같이 추가 작업이 남아있습니다. 작업단위 별로 추가 PR 올릴 예정입니다. (목~금 예정)
    • 공통 css 변수 적용 & QA 반영한 스타일 수정
    • 팔로워 버튼 api 연동
    • 리스트 무한스크롤 기능

스크린샷

  • 기존 리스트 페이지 디자인에서 일부 스타일만 수정해서 변동사항이 없습니다.

리뷰어에게

  • [userNickname] 폴더를 [userId]폴더로 변경함에 따라 리스트 관련 페이지 및 컴포넌트는 변경하였지만, 리스트 상세페이지(나현님, 현지님 작업)는 변경하지 않고, [userNickname] 폴더에 그대로 두었습니다. 참고 부탁드립니다.

  • 리스트 조회 페이지에서 클릭하면 이동하는 페이지에 대한 폴더를 생성해 두었습니다.
    ㄴ (1)user/[userId]/followers (2)user/[userId]/followings (3)/account

  • 페이지 이동 router.push 관련 코드를 hook으로 생성했습니다.
    ㄴ (생성 배경) next/Link가 a태그 기반이라 css 이슈(파랑색 글씨) 등이 발생하여 text-decoration을 'none'으로 설정했으나, 일부 버튼에서는 router로 이동하기 위해 hook을 생성하게 되었습니다.
    ㄴ (추가 활용) 관련 hook은 추후 (필요하다면) 방문페이지 path를 저장하는데에 활용될 수 있을 것 같습니다.


@ParkSohyunee ParkSohyunee added Feat 구현 Design UI 수정 Style 코드 스타일 변경 labels Feb 7, 2024
@ParkSohyunee ParkSohyunee self-assigned this Feb 7, 2024
Copy link

vercel bot commented Feb 7, 2024

@ParkSohyunee is attempting to deploy a commit to the Eujin Ahn's projects Team on Vercel.

A member of the Team first needs to authorize it.

Comment on lines 4 to 11
const accessToken = '';

export const createList = async (data: ListCreateType) => {
const response = await axiosInstance.post<ListIdType>('/lists', data);
const response = await axiosInstance.post<ListIdType>('/lists', data, {
headers: {
Authorization: `Bearer ${accessToken}`,
},
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

이 부분 테스트하기 위해 추가하였는데 원래대로 수정하겠습니다~!🥲

Copy link
Contributor

@seoyoung-min seoyoung-min left a comment

Choose a reason for hiding this comment

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

소현님, 고민이 많이 담겨 있는 코드들이라 소중하게 잘 읽었습니다🧁
코드가 깔끔하고 주석도 잘 달어주셔서 코드리뷰하기 정말 편했습니다! 감사합니다 :)

@@ -19,7 +19,9 @@ export const options = style({
});

export const link = style({
// position: 'relative',
Copy link
Contributor

Choose a reason for hiding this comment

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

주석발견! 필요한 주석일까요??


const { data: userData } = useQuery<UserType>({
queryKey: [QUERY_KEYS.userOne],
queryFn: () => getUserOne(userId),
Copy link
Contributor

Choose a reason for hiding this comment

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

(궁금) 바로 getUserOne(userId)를 작성하지 않고, ()=>{}로 감싸신 이유가 궁금합니다!🤔🙇‍♀️

Copy link
Contributor Author

Choose a reason for hiding this comment

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

서영님 덕분에 쿼리키에 파라미터를 함께 넣지 않았다는 사실을 발견하였습니다!! 감사합니다.👍
또, queryFn에는 호출할 함수를 넣어주기 위해 함수를 전달하였습니다~!
getUserOne(userId)을 넣게되면 함수를 바로 호출하는 것으로 알고있어서 아마 타입에러가 발생할 것 같습니다..!
ㄴ 확인해보니 타입에러가 발생하네요..!!

queryKey: [QUERY_KEYS.userOne, userId],

+. (참고) 서영님께서 담당하시는 프로필페이지에서 사용자 정보 불러올때 동일한 쿼리키 사용해 주시면 될 것 같습니다.

Comment on lines +40 to +44
/** 무한스크롤시 리액트 쿼리로 불러오는게 더 나을지에 대한 고민 때문에 주석처리 해 놓은 코드 */
// const { data: listData, refetch } = useQuery<AllListType>({
// queryKey: [QUERY_KEYS.getAllList],
// queryFn: () => getAllList(userId, type),
// });
Copy link
Contributor

Choose a reason for hiding this comment

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

꼼꼼한 주석처리, 이해하기 너무 좋네요👍 저도 배워서 적용하겠습니다! 감사합니다🙇‍♀️

Comment on lines +46 to +56
const handleFetchLists = useCallback(
async (category?: string) => {
const data = await getAllList(userId, type, category);
setListGrid(data.feedLists);
},
[userId, type]
);

const handleFetchListsOnCategory = async (category: string) => {
handleFetchLists(category);
};
Copy link
Contributor

Choose a reason for hiding this comment

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

이렇게 중복을 줄일 수 있군요 짱입니다👍👍👍

@@ -45,6 +44,9 @@ export const profile = style({
});

export const avatar = style({
Copy link
Contributor

Choose a reason for hiding this comment

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

혹시 avatar대신 profileImage는 어떨까요??
사실 avatar라는 이름보고도 어떤 요소인지 이해가 바로 됐기에 수정을 안해도 좋지만
저희가 기본 이미지도 사람이 아닌 파도가 될수도 있을 것 같아, 제안드려봅니다 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

서영님 이부분 저번에 alt는 수정하였는데 스타일 네이밍을 수정하지 않았네요..🥲
확인해 주셔서 감사합니다. 다음번엔 꼼꼼히 확인하도록 하겠습니다!!

Comment on lines 45 to 46
<div className={styles.header}>
<ArrowLeftIcon alt="이전 페이지로 이동하기" className={styles.icon} />
Copy link
Contributor

Choose a reason for hiding this comment

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

문득... 저희 피드에서는 하단탭이 존재하기 때문에 뒤로가기 버튼이 없어도 되겠다는 생각이 들었습니다! 소현님께서는 어떻게 생각하시나요??

Comment on lines +11 to +16
const onClickMoveToPage = (path: string) => () => {
router.push(path);
};

return { onClickMoveToPage };
}
Copy link
Contributor

Choose a reason for hiding this comment

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

감사히 쓰겠습니다!🥰👍👍

@seoyoung-min
Copy link
Contributor

배포 에러가 create page에서 났습니다. 저도 나서 이 부분 수정했는데, 아직 머지가 안 돼 동일한 에러가 나는 것 같아요!
에러 원인은 프리티어 엔터적용이 안돼서 인데요! (왜 이전에는 통과됐는지 의문입니다ㅠ)
create/page에서 저장 한 번만 해주셔서 119번째 줄이 prettier 적용으로, 구조분해할당한 부분이 엔터가 되게끔 해주시면 해결이 됩니다! 감사합니다🥹

Screenshot 2024-02-08 at 01 24 00

Copy link
Contributor

@Nahyun-Kang Nahyun-Kang left a comment

Choose a reason for hiding this comment

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

소현님 마이리스트, 콜라보리스트 api 연동하시느라 고생 정말 많으셨습니다!! 추가적으로 공용으로 쓸 수 있는 router 훅도 만들어주셔서 감사합니다👍🙇‍♀️ 리액트 쿼리를 너무 잘 쓰셔서 소현님 PR은 교재같아요..! 🥹 LGTM👍

@ParkSohyunee ParkSohyunee merged commit 8928999 into 8-Sprinters:dev Feb 8, 2024
1 of 2 checks passed
@ParkSohyunee ParkSohyunee deleted the feature/feed-api branch August 3, 2024 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Design UI 수정 Feat 구현 Style 코드 스타일 변경
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants