Skip to content

Conversation

@ChoYenii
Copy link
Contributor

@ChoYenii ChoYenii commented Nov 19, 2024

🔖 Issue Ticket

Ticket

✍️ Description

마이 페이지의 ReviewSection 컴포넌트를 ReviewTabs로 수정하고
my-page 폴더 아래에 각 탭마다 라우팅 될 reviewable과 my-review 폴더를 만들었습니다.

✅ Checklist

PR

  • Branch Convention 확인

    feat/ 피쳐, fix/ 버그 수정, refactor/ 개선

  • Base Branch 확인
  • 적절한 Label 지정
  • Assignee 및 Reviewer 지정

Test

  • 로컬 작동 확인

Summary by CodeRabbit

  • 새로운 기능
    • ReviewTabs 컴포넌트 추가: 사용자 리뷰 및 작성 가능한 모임을 위한 탭 인터페이스 제공.
    • MyPage 레이아웃 컴포넌트 추가: 사용자 프로필 및 리뷰 탭을 포함하는 구조화된 레이아웃 제공.
    • MyReviewPageReviewableGatheringsPage 컴포넌트 추가: 각각 '내 리뷰 목록' 및 '작성 가능한 모임 목록' 표시.
  • 변경 사항
    • ReviewSection 컴포넌트 제거: 리뷰 표시 및 작성 기능 제거.
    • MyPage 컴포넌트 수정: UI 요소 렌더링에서 /my-page/reviewable로 리디렉션으로 변경.

@ChoYenii ChoYenii linked an issue Nov 19, 2024 that may be closed by this pull request
3 tasks
@coderabbitai
Copy link

coderabbitai bot commented Nov 19, 2024

Walkthrough

이번 변경사항은 ReviewSection 컴포넌트를 삭제하고, 새로운 ReviewTabs, MyPage, MyReviewPage, ReviewableGatheringsPage 컴포넌트를 추가하는 내용을 포함합니다. ReviewTabs는 탭 네비게이션을 관리하며, MyPage는 전체 레이아웃을 구성합니다. MyReviewPageReviewableGatheringsPage는 각각 사용자의 리뷰 목록과 검토 가능한 모임 목록을 표시하는 간단한 컴포넌트입니다. 또한, MyPage 컴포넌트는 더 이상 UI 요소를 렌더링하지 않고 사용자를 /my-page/reviewable 경로로 리디렉션합니다.

Changes

파일 경로 변경 요약
src/app/(crew)/my-page/_components/review-section.tsx 컴포넌트 삭제: ReviewSection 컴포넌트가 삭제됨.
src/app/(crew)/my-page/_components/review-tabs.tsx 컴포넌트 추가: ReviewTabs 컴포넌트가 추가되어 탭 네비게이션을 관리함.
src/app/(crew)/my-page/layout.tsx 컴포넌트 추가: MyPage 컴포넌트가 추가되어 전체 레이아웃을 구성함.
src/app/(crew)/my-page/my-review/page.tsx 컴포넌트 추가: MyReviewPage 컴포넌트가 추가되어 "my review list component" 텍스트를 렌더링함.
src/app/(crew)/my-page/page.tsx 변경: MyPage 컴포넌트가 UI 요소를 렌더링하는 대신 /my-page/reviewable로 리디렉션함.
src/app/(crew)/my-page/reviewable/page.tsx 컴포넌트 추가: ReviewableGatheringsPage 컴포넌트가 추가되어 "reviewable gathering list component" 텍스트를 렌더링함.

Possibly related PRs

Suggested labels

components, pages, fix

Suggested reviewers

  • yulrang
  • HaeJungg
  • User850413

Poem

🐰 변화의 바람이 불어와
새로운 탭이 열리네,
리뷰와 모임, 함께하자,
사용자와 소통하는 길,
즐거운 페이지가 펼쳐지네! 🌼

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.

src/app/(crew)/my-page/_components/review-tabs.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't determine the plugin "react-hooks" uniquely.

  • /node_modules/eslint-plugin-react-hooks/index.js (loaded in ".eslintrc.js")
  • /node_modules/eslint-config-next/node_modules/eslint-plugin-react-hooks/index.js (loaded in ".eslintrc.js » eslint-config-next/core-web-vitals » /node_modules/eslint-config-next/index.js » plugin:react-hooks/recommended")

Please remove the "plugins" setting from either config or remove either plugin installation.

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 76f5456 and 2937998.

📒 Files selected for processing (1)
  • src/app/(crew)/my-page/_components/review-tabs.tsx (1 hunks)
🧰 Additional context used
🪛 Biome
src/app/(crew)/my-page/_components/review-tabs.tsx

[error] 25-28: The catch clause that only rethrows the original error is useless.

An unnecessary catch clause can be confusing.
Unsafe fix: Remove the try/catch clause.

(lint/complexity/noUselessCatch)


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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.

@github-actions
Copy link

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: 2

🧹 Outside diff range and nitpick comments (6)
src/app/(crew)/my-page/page.tsx (1)

1-1: 'use client' 지시문이 필요한지 검토가 필요합니다.

리다이렉션만 수행하는 컴포넌트의 경우 서버 컴포넌트로 구현하는 것이 더 효율적일 수 있습니다. Next.js의 서버 컴포넌트에서도 리다이렉션이 가능합니다.

다음과 같이 변경을 고려해보세요:

-'use client';
-
-import { redirect } from 'next/navigation';
+import { redirect } from 'next/navigation';

 export default function MyPage() {
   redirect('/my-page/reviewable');
 }
src/app/(crew)/my-page/layout.tsx (3)

1-2: 일관된 import 경로 스타일 사용 권장

현재 import 문에서 절대 경로와 상대 경로가 혼용되고 있습니다. 코드의 일관성과 유지보수를 위해 동일한 스타일의 경로를 사용하는 것이 좋습니다.

다음과 같이 수정하는 것을 제안드립니다:

import ProfileCardContainer from '@/src/app/(crew)/my-page/_components/profile-card/container';
-import ReviewTabs from './_components/review-tabs';
+import ReviewTabs from '@/src/app/(crew)/my-page/_components/review-tabs';

11-11: 불필요한 빈 div 요소 제거

목적이 없는 빈 div 요소가 있습니다. 레이아웃이나 스타일링에 필요하지 않다면 제거하는 것이 좋습니다.

-      <div />

4-14: 컴포넌트 개선 제안

다음 사항들을 고려해보시면 좋을 것 같습니다:

  1. 에러 바운더리 추가로 컴포넌트 실패 처리
  2. 로딩 상태 처리 추가
  3. 반복되는 Tailwind 클래스를 상수나 컴포넌트로 추출

에러 바운더리 예시:

import { ErrorBoundary } from 'react-error-boundary';

export default function MyPage() {
  return (
    <ErrorBoundary fallback={<ErrorFallback />}>
      <div className="container mx-auto my-0 min-h-screen max-w-pc bg-gray-50 px-3 py-11 md:px-8 lg:px-11">
        {/* ... */}
      </div>
    </ErrorBoundary>
  );
}
src/app/(crew)/my-page/_components/review-tabs.tsx (2)

9-13: 탭 설정을 상수 파일로 분리하는 것을 고려해보세요.

탭 설정을 별도의 상수 파일로 분리하면 다음과 같은 이점이 있습니다:

  • 설정의 재사용성 향상
  • 유지보수성 개선
  • 설정 변경 시 중앙 관리 가능
+ // src/constants/tabs.ts
+ export const MY_PAGE_TABS = [
+   { label: '작성 가능한 리뷰', id: 'available-review', route: '/my-page/reviewable' },
+   { label: '작성한 리뷰', id: 'my-review', route: '/my-page/my-review' },
+ ] as const;

- const myPageTabs = [
-   { label: '작성 가능한 리뷰', id: 'available-review', route: '/my-page/reviewable' },
-   { label: '작성한 리뷰', id: 'my-review', route: '/my-page/my-review' },
- ];
+ const myPageTabs = MY_PAGE_TABS;

24-44: 무한 스크롤 구현 계획을 이슈로 트래킹하면 좋겠습니다.

주석 처리된 무한 스크롤 구현 코드가 있습니다. 이 기능의 구현 계획을 GitHub 이슈로 생성하여 트래킹하는 것이 좋겠습니다.

이슈 생성을 도와드릴까요? 다음과 같은 내용으로 이슈를 만들 수 있습니다:

  • 제목: "리뷰 탭에 무한 스크롤 기능 구현"
  • 설명: 구현해야 할 기능 명세와 참고 사항
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between cf27bbb and 76f5456.

📒 Files selected for processing (6)
  • src/app/(crew)/my-page/_components/review-section.tsx (0 hunks)
  • src/app/(crew)/my-page/_components/review-tabs.tsx (1 hunks)
  • src/app/(crew)/my-page/layout.tsx (1 hunks)
  • src/app/(crew)/my-page/my-review/page.tsx (1 hunks)
  • src/app/(crew)/my-page/page.tsx (1 hunks)
  • src/app/(crew)/my-page/reviewable/page.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • src/app/(crew)/my-page/_components/review-section.tsx
✅ Files skipped from review due to trivial changes (2)
  • src/app/(crew)/my-page/my-review/page.tsx
  • src/app/(crew)/my-page/reviewable/page.tsx
🔇 Additional comments (2)
src/app/(crew)/my-page/page.tsx (1)

6-6: 즉시 리다이렉션의 사용자 경험 검토가 필요합니다.

사용자가 /my-page로 직접 접근했을 때 즉시 리다이렉션되는 것이 혼란을 줄 수 있습니다.

다음 사항들을 확인해주세요:

  1. SEO에 미치는 영향
  2. 브라우저 히스토리 관리
  3. 사용자에게 리다이렉션 이유를 설명하는 UI 필요 여부

다음과 같은 대안을 고려해보세요:

  1. 메인 페이지에서 기본 컨텐츠를 표시하고 탭 네비게이션을 통해 이동하게 하기
  2. 리다이렉션 전에 로딩 상태나 안내 메시지 표시하기
src/app/(crew)/my-page/_components/review-tabs.tsx (1)

1-7: 필요한 의존성들이 올바르게 임포트되었습니다!

클라이언트 컴포넌트 지시문과 필요한 훅들이 적절하게 임포트되어 있습니다.

Comment on lines 15 to 22
const handleTabClick = (id: string) => {
setCurrentTab(id);

const selectedTab = myPageTabs.find((tab) => tab.id === id);
if (selectedTab?.route) {
router.push(selectedTab.route);
}
};
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

라우팅 에러 처리를 추가하는 것이 좋겠습니다.

현재 라우팅 실패에 대한 에러 처리가 없습니다. 사용자 경험 향상을 위해 에러 처리를 추가하는 것을 추천드립니다.

  const handleTabClick = (id: string) => {
    setCurrentTab(id);

    const selectedTab = myPageTabs.find((tab) => tab.id === id);
    if (selectedTab?.route) {
-     router.push(selectedTab.route);
+     try {
+       router.push(selectedTab.route);
+     } catch (error) {
+       console.error('탭 이동 중 오류가 발생했습니다:', error);
+       // TODO: 사용자에게 에러 알림 표시
+     }
    }
  };

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +45 to +59
return (
<div className="mt-12 flex flex-col">
<h3 className="text-2xl font-semibold text-gray-900">나의 리뷰 모아보기</h3>
<Divider mt={16} mb={24} size={2} />
<div className="flex justify-start">
<Tabs
variant="review"
tabs={myPageTabs}
activeTab={currentTab}
onTabClick={handleTabClick}
/>
</div>
</div>
);
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

접근성 개선을 위한 aria 속성 추가가 필요합니다.

스크린 리더 사용자를 위해 탭 컴포넌트에 적절한 aria 레이블을 추가하면 좋겠습니다.

  <div className="mt-12 flex flex-col">
-   <h3 className="text-2xl font-semibold text-gray-900">나의 리뷰 모아보기</h3>
+   <h3 className="text-2xl font-semibold text-gray-900" id="review-section-title">나의 리뷰 모아보기</h3>
    <Divider mt={16} mb={24} size={2} />
-   <div className="flex justify-start">
+   <div className="flex justify-start" role="tablist" aria-labelledby="review-section-title">
      <Tabs
        variant="review"
        tabs={myPageTabs}
        activeTab={currentTab}
        onTabClick={handleTabClick}
+       aria-label="리뷰 탭 네비게이션"
      />
    </div>
  </div>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return (
<div className="mt-12 flex flex-col">
<h3 className="text-2xl font-semibold text-gray-900">나의 리뷰 모아보기</h3>
<Divider mt={16} mb={24} size={2} />
<div className="flex justify-start">
<Tabs
variant="review"
tabs={myPageTabs}
activeTab={currentTab}
onTabClick={handleTabClick}
/>
</div>
</div>
);
}
return (
<div className="mt-12 flex flex-col">
<h3 className="text-2xl font-semibold text-gray-900" id="review-section-title">나의 리뷰 모아보기</h3>
<Divider mt={16} mb={24} size={2} />
<div className="flex justify-start" role="tablist" aria-labelledby="review-section-title">
<Tabs
variant="review"
tabs={myPageTabs}
activeTab={currentTab}
onTabClick={handleTabClick}
aria-label="리뷰 탭 네비게이션"
/>
</div>
</div>
);
}

Copy link
Contributor

@minkyung5x5 minkyung5x5 left a comment

Choose a reason for hiding this comment

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

수고많으셨습니다!!!! 👍

@github-actions
Copy link

Copy link
Contributor

@HaeJungg HaeJungg left a comment

Choose a reason for hiding this comment

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

수고하셨슴니다👏

@ChoYenii ChoYenii merged commit a16dc81 into develop Nov 20, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

마이 페이지의 탭 동작 부분 수정

4 participants