Skip to content

Conversation

@YouD0313
Copy link
Collaborator

@YouD0313 YouD0313 commented May 17, 2025

구현내용

유저페이지 카테고리 분리, ui 수정 공통 컴포넌트 사용 커스텀훅 조건문 분기처리하여 api 사용
공지사항 상세보기에 조회수 기능을 위해 인피니티 삭제
FAQ 더보기 버튼에서 더보기 문구가 움직이는 애니메이션 추가

연관이슈

close #302

Summary by CodeRabbit

  • 신규 기능

    • 유저가 참여한 프로젝트와 관리하는 프로젝트를 각각 확인할 수 있는 메뉴 및 페이지가 추가되었습니다.
    • 프로젝트 목록이 하나의 컴포넌트에서 조건에 따라 분기되어 표시됩니다.
  • 버그 수정

    • 프로젝트 관련 경로 및 메뉴명이 일관성 있게 정비되었습니다.
  • 스타일

    • FAQ 더보기 버튼에 애니메이션 효과가 추가되었습니다.
  • 리팩터

    • 프로젝트 데이터 구조가 단순화되어, 프로젝트 분류 방식이 개선되었습니다.
  • 기타

    • 사용하지 않는 컴포넌트 및 타입이 정리되었습니다.

@YouD0313 YouD0313 requested a review from layout-SY May 17, 2025 15:12
@YouD0313 YouD0313 self-assigned this May 17, 2025
@YouD0313 YouD0313 linked an issue May 17, 2025 that may be closed by this pull request
5 tasks
@coderabbitai
Copy link

coderabbitai bot commented May 17, 2025

"""

Walkthrough

이번 변경에서는 userPage의 프로젝트 관련 기능이 개선되었습니다. 참여한 프로젝트와 기획한 프로젝트를 별도의 API로 분리하여 각각 조회하도록 수정되었고, 이에 따라 UI와 라우트, 관련 컴포넌트 및 타입 정의가 업데이트되었습니다. 공지사항 디테일 데이터의 staleTime, gcTime 옵션도 제거되었습니다.

Changes

파일/경로 변경 요약
src/api/userpage.api.ts, src/models/userProject.ts 프로젝트 API 타입 및 함수 분리: 참여/기획 프로젝트 조회 함수 및 타입 정의/수정
src/components/user/userPage/joinedProject/UserJoinProject.tsx 참여 프로젝트 컴포넌트 삭제
src/components/user/userPage/userProjectList/UserProjectList.tsx 참여/기획 프로젝트 리스트 통합 컴포넌트(UserProjects) 추가
src/constants/user/routes.ts, src/pages/user/mypage/MyPage.tsx, src/pages/user/userpage/UserPage.tsx, src/routes/AppRoutes.tsx 프로젝트 관련 라우트 키 및 경로명 통일, 메뉴 항목 및 라우트 구조 변경
src/hooks/queries/user/keys.ts userManagedList 쿼리 키 추가
src/hooks/user/useGetNoticeDetail.ts 공지사항 디테일 쿼리 옵션(staleTime, gcTime) 제거
src/hooks/user/useGetUserProjectList.ts 참여/기획 프로젝트 구분하여 API 호출하는 custom hook 추가
src/hooks/user/useUserInfo.ts 참여 프로젝트 관련 hook 및 import 제거
src/pages/user/customerService/faq/FAQ.styled.ts, src/pages/user/customerService/faq/FAQ.tsx FAQ 더보기 버튼에 애니메이션 효과 추가, 스타일 컴포넌트 구조 변경

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UserPage
    participant UserProjects
    participant useGetUserProjectList
    participant API

    User->>UserPage: 메뉴에서 '참여 프로젝트' 또는 '기획 프로젝트' 선택
    UserPage->>UserProjects: 해당 경로로 이동
    UserProjects->>useGetUserProjectList: 프로젝트 종류(참여/기획) 및 userId 전달
    useGetUserProjectList->>API: getUserJoinedProjectList 또는 getUserManagedProjectList 호출
    API-->>useGetUserProjectList: 프로젝트 리스트 반환
    useGetUserProjectList-->>UserProjects: 데이터, 로딩 상태, 타이틀 반환
    UserProjects-->>User: 프로젝트 리스트 렌더링
Loading

Assessment against linked issues

Objective Addressed Explanation
공지사항 디테일 데이터 staleTime, gcTime 제거 (#302)
참여한 프로젝트 ui 수정 (#302)
참여한 프로젝트 api 연결 (#302)
기획한 프로젝트 사이드바 카테고리 + ui 추가 (#302)
기획한 프로젝트 api 연결 (#302)

Suggested labels

⛏기능, 🛠개선

Suggested reviewers

  • layout-SY

Poem

🐇
프로젝트 탭이 둘로 나뉘었네,
참여와 기획, 구분이 쉽지!
API도 분리해 깔끔하게,
사이드바엔 새 카테고리 등장했지.
토끼는 뿌듯, 코드도 반짝—
오늘도 성장하는 우리 서비스,
깡총깡총, 앞으로 Go!

"""

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm warn config production Use --omit=dev instead.
npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /.npm/_logs/2025-05-17T15_21_17_983Z-debug-0.log


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ca28be2 and b3d674b.

📒 Files selected for processing (2)
  • src/components/user/mypage/joinedProject/MyJoinProjects.tsx (0 hunks)
  • src/components/user/userPage/userProjectList/UserProjectList.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • src/components/user/mypage/joinedProject/MyJoinProjects.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/user/userPage/userProjectList/UserProjectList.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: accessibility-test
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
src/pages/user/customerService/faq/FAQ.styled.ts (1)

41-62: 애니메이션 효과가 적절하게 구현되었습니다.

ShowMoreSpan 컴포넌트에 bounce 애니메이션을 추가한 방식이 잘 구현되었습니다. 몇 가지 의견을 드리자면:

  1. 애니메이션 속도(0.4s)와 변위(-3px)가 적절합니다. 과도하지 않고 사용자 경험에 도움이 될 것 같습니다.
  2. keyframes를 분리하여 재사용 가능하게 만드는 것도 고려해볼 수 있습니다.

keyframes를 분리하여 재사용성을 높이는 방법도 고려해볼 수 있습니다:

+const bounceAnimation = keyframes`
+  0% {
+    transform: translateY(0);
+  }
+  50% {
+    transform: translateY(-3px);
+  }
+  100% {
+    transform: translateY(0);
+  }
+`;

export const ShowMoreSpan = styled.span`
  width: 100%;
  padding: 1.2rem 0;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
-  @keyframes bounce {
-    0% {
-      transform: translateY(0);
-    }
-    50% {
-      transform: translateY(-3px);
-    }
-    100% {
-      transform: translateY(0);
-    }
-  }

  &:hover {
-    animation: bounce 0.4s infinite;
+    animation: ${bounceAnimation} 0.4s infinite;
  }
`;
src/hooks/user/useGetUserProjectList.ts (1)

10-17: 조건부 분기 로직 간소화 가능합니다.

현재 코드는 분기 처리가 잘 되어 있지만, 불필요한 삼항 연산자 사용이 있습니다.

다음과 같이 간소화할 수 있습니다:

- const isJoinedPage = location.pathname.includes('joined') ? true : false;
+ const isJoinedPage = location.pathname.includes('joined');
🧰 Tools
🪛 Biome (1.9.4)

[error] 13-13: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

src/components/user/userPage/userProjectList/UserProjectList.tsx (1)

27-35: 불필요한 옵셔널 체이닝이 있습니다.

이미 24번 줄에서 userProjectData && userProjectData.length > 0 조건을 확인했기 때문에 27번 줄의 userProjectData?.map 옵셔널 체이닝은 불필요합니다.

-            {userProjectData?.map((project) => (
+            {userProjectData.map((project) => (
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 575d9e0 and ca28be2.

📒 Files selected for processing (14)
  • src/api/userpage.api.ts (3 hunks)
  • src/components/user/userPage/joinedProject/UserJoinProject.tsx (0 hunks)
  • src/components/user/userPage/userProjectList/UserProjectList.tsx (1 hunks)
  • src/constants/user/routes.ts (1 hunks)
  • src/hooks/queries/user/keys.ts (1 hunks)
  • src/hooks/user/useGetNoticeDetail.ts (0 hunks)
  • src/hooks/user/useGetUserProjectList.ts (1 hunks)
  • src/hooks/user/useUserInfo.ts (1 hunks)
  • src/models/userProject.ts (1 hunks)
  • src/pages/user/customerService/faq/FAQ.styled.ts (1 hunks)
  • src/pages/user/customerService/faq/FAQ.tsx (1 hunks)
  • src/pages/user/mypage/MyPage.tsx (1 hunks)
  • src/pages/user/userpage/UserPage.tsx (1 hunks)
  • src/routes/AppRoutes.tsx (3 hunks)
💤 Files with no reviewable changes (2)
  • src/hooks/user/useGetNoticeDetail.ts
  • src/components/user/userPage/joinedProject/UserJoinProject.tsx
🧰 Additional context used
🧬 Code Graph Analysis (6)
src/pages/user/mypage/MyPage.tsx (1)
src/constants/user/routes.ts (1)
  • ROUTES (1-32)
src/models/userProject.ts (1)
src/models/apiCommon.ts (1)
  • ApiCommonType (1-4)
src/pages/user/userpage/UserPage.tsx (1)
src/constants/user/routes.ts (1)
  • ROUTES (1-32)
src/hooks/user/useGetUserProjectList.ts (3)
src/models/userProject.ts (1)
  • ApiUserProject (28-30)
src/hooks/queries/user/keys.ts (1)
  • userInfoKey (16-20)
src/api/userpage.api.ts (2)
  • getUserJoinedProjectList (16-27)
  • getUserManagedProjectList (29-40)
src/components/user/userPage/userProjectList/UserProjectList.tsx (4)
src/hooks/user/useGetUserProjectList.ts (1)
  • useGetUserProjectList (10-27)
src/components/common/loadingSpinner/LoadingSpinner.styled.ts (1)
  • Spinner (21-28)
src/constants/user/routes.ts (1)
  • ROUTES (1-32)
src/components/common/noContent/NoContent.tsx (1)
  • NoContent (14-30)
src/api/userpage.api.ts (2)
src/api/http.api.ts (1)
  • httpClient (78-78)
src/models/userProject.ts (1)
  • ApiUserProject (28-30)
🪛 Biome (1.9.4)
src/hooks/user/useGetUserProjectList.ts

[error] 13-13: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

🔇 Additional comments (22)
src/pages/user/customerService/faq/FAQ.tsx (1)

60-63: 더보기 버튼에 애니메이션 처리가 잘 적용되었습니다.

ShowMoreSpan 컴포넌트로 텍스트와 아이콘을 감싸서 호버 시 애니메이션 효과를 적용한 접근 방식이 좋습니다. 사용자 경험이 향상될 것으로 보입니다.

src/hooks/queries/user/keys.ts (1)

19-19: 새 쿼리 키 추가가 적절합니다.

userManagedList 키 추가는 유저가 관리하는 프로젝트 목록을 가져오는 기능을 지원하는 변경사항입니다. 이는 PR의 목적인 유저 페이지 카테고리 분리와 잘 일치합니다.

src/pages/user/mypage/MyPage.tsx (1)

23-23: 경로 업데이트가 올바르게 적용되었습니다.

기존 mypageJoinedProjects 대신 joinedProjects로 경로 키가 변경되었습니다. 이는 src/constants/user/routes.ts의 변경사항과 일치하며, 전체 애플리케이션에서 일관된 라우팅 네이밍 컨벤션을 유지합니다.

src/hooks/user/useUserInfo.ts (1)

5-5: API 임포트 경로가 적절합니다.

getUserInfo 함수 임포트가 명확하게 되어 있습니다. useUserJoinedProjectList 훅이 제거된 것은 프로젝트 관련 데이터 가져오기에 대한 리팩토링의 일부로서 적절합니다.

src/pages/user/userpage/UserPage.tsx (2)

19-22: 참여 프로젝트 메뉴 경로가 올바르게 업데이트 되었습니다.

ROUTES.userJoinedProject 대신 ROUTES.joinedProjects를 사용하도록 경로가 올바르게 변경되었습니다. 이는 전체 애플리케이션의 라우팅 네이밍 컨벤션과 일치합니다.


23-26: 기획 프로젝트 메뉴 추가가 적절합니다.

유저 페이지에 기획 프로젝트 메뉴가 추가되어 카테고리 분리가 완성되었습니다. 아이콘과 경로 설정이 참여 프로젝트 메뉴와 일관성 있게 구성되어 있습니다.

src/models/userProject.ts (1)

28-30: 새로운 인터페이스 추가가 잘 되었습니다.

ApiUserProject 인터페이스가 추가되어 사용자 프로젝트 데이터를 더 단순한 구조로 표현하고 있습니다. 이를 통해 참여한 프로젝트와 기획한 프로젝트를 일관된 방식으로 처리할 수 있게 되었습니다.

src/api/userpage.api.ts (3)

2-2: 타입 임포트 업데이트가 적절합니다.

이전 ApiSelectUserProject 대신 새로운 ApiUserProject 타입을 임포트하여 코드 일관성을 유지했습니다.


18-19: API 엔드포인트 변경이 잘 이루어졌습니다.

참여한 프로젝트 목록을 가져오는 엔드포인트가 /user/${id}/project에서 더 명확한 /user/${id}/participated로 변경되었습니다. 이는 사용자 프로젝트 분리 개념과 잘 맞습니다.


29-40: 새로운 API 함수 추가가 적절합니다.

기획한 프로젝트 목록을 가져오는 getUserManagedProjectList 함수가 추가되었습니다. 에러 처리와 로깅이 일관되게 구현되었고, 기존 API 패턴을 잘 따르고 있습니다.

src/hooks/user/useGetUserProjectList.ts (3)

1-9: 임포트 구성이 적절합니다.

필요한 모든 의존성을 가져오고 있으며, 임포트 그룹화가 잘 되어 있습니다.


18-24: 쿼리 키 설정이 적절하지 않을 수 있습니다.

쿼리 키에 userInfoKey.userManagedList를 사용하고 있지만, isJoinedPagetrue일 때는 조인된 프로젝트를 가져옵니다. 조인된 프로젝트와 관리된 프로젝트에 대해 서로 다른 쿼리 키를 사용하는 것이 더 정확할 수 있습니다.

다음과 같이 수정하여 케이스별로 정확한 쿼리 키를 사용하는 것이 좋습니다:

  const { data, isLoading } = useQuery<ApiUserProject>({
-   queryKey: [userInfoKey.userManagedList, userId, isJoinedPage],
+   queryKey: [
+     isJoinedPage 
+       ? userInfoKey.userJoinedList 
+       : userInfoKey.userManagedList, 
+     userId
+   ],
    queryFn: () =>
      isJoinedPage
        ? getUserJoinedProjectList(Number(userId))
        : getUserManagedProjectList(Number(userId)),
  });

25-27: 반환 구조가 잘 정의되어 있습니다.

필요한 데이터, 로딩 상태, 그리고 제목을 적절히 반환하고 있어 컴포넌트에서 쉽게 사용할 수 있습니다.

src/constants/user/routes.ts (1)

14-15: 경로 상수명 변경이 일관성 있게 적용되었습니다.

joinedProjectsmanagedProjects로 경로 상수명이 변경되어 전체 PR의 목적인 사용자 페이지 카테고리 분리와 일치합니다. 이는 UI 컴포넌트와 API 호출 분리에도 반영되었습니다.

src/components/user/userPage/userProjectList/UserProjectList.tsx (4)

1-8: 코드 가져오기 및 구성이 명확합니다.

모든 필요한 컴포넌트와 훅들이 적절하게 가져와져 있습니다. 마이페이지의 스타일 컴포넌트를 재사용하는 것은 일관성 측면에서 좋은 접근입니다.


10-12: 훅 사용이 적절합니다.

useGetUserProjectList 훅을 통해 경로에 따라 적절한 프로젝트 데이터를 가져오는 방식이 효율적입니다. 구조 분해 할당으로 필요한 데이터를 명확하게 추출하고 있습니다.


13-16: 로딩 상태 처리가 잘 되어 있습니다.

데이터 로딩 중에는 스피너를 표시하여 사용자에게 시각적 피드백을 제공하는 좋은 UX 패턴입니다.


19-42: 프로젝트 목록 표시 로직이 잘 구현되어 있습니다.

프로젝트 데이터 존재 여부에 따라 적절히 다른 UI를 렌더링하는 조건부 렌더링이 잘 적용되어 있습니다. 빈 목록일 경우 NoContent 컴포넌트를 표시하여 사용자에게 적절한 피드백을 제공합니다.

src/routes/AppRoutes.tsx (4)

95-97: 새 컴포넌트 임포트가 적절하게 추가되었습니다.

기존의 분리된 컴포넌트를 통합된 UserProjects 컴포넌트로 대체하는 좋은 리팩토링입니다. 레이지 로딩 패턴을 유지하여 성능 최적화를 고려했습니다.


269-270: 경로 상수 업데이트가 일관성 있게 적용되었습니다.

마이페이지의 경로가 ROUTES.joinedProjects로 업데이트되어 전체 애플리케이션에서 경로 네이밍이 일관되게 유지됩니다.


325-331: 사용자 페이지에 분리된 카테고리 라우트가 잘 구현되었습니다.

이제 사용자 페이지에서 참여한 프로젝트와 기획한 프로젝트를 별도의 라우트로 구분하면서도 동일한 UserProjects 컴포넌트를 재사용하는 좋은 구조입니다. 이는 코드 중복을 줄이고 유지보수성을 높입니다.


245-332: 경로 구조와 접근 제어가 잘 구현되었습니다.

사용자 페이지와 마이페이지 모두 ProtectRoute를 통해 인증된 사용자만 접근할 수 있도록 하고, 중첩된 라우트를 통해 관련 기능을 논리적으로 그룹화하여 사용자 경험과 코드 구조가 개선되었습니다.

@YouD0313 YouD0313 merged commit 42fcf00 into develop May 17, 2025
4 checks passed
@YouD0313 YouD0313 deleted the feat/#302 branch May 17, 2025 15:37
@YouD0313 YouD0313 changed the title 유저페이지 카테고리 분리, 공지사항 상세 인피티니 삭제, FAQ 더보기 애니메이션 추가 #302 유저페이지 카테고리 분리, 공지사항 상세 인피티니 삭제, FAQ 더보기 애니메이션 추가 (#isseu 302) May 22, 2025
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.

userPage 프로젝트 카테고리 나눠서 별도의 api로 받기

3 participants