Skip to content

Conversation

@HaeJungg
Copy link
Contributor

@HaeJungg HaeJungg commented Nov 14, 2024

๐Ÿ”– Issue Ticket

#121

โœ๏ธ Description

  • ์ฐœํ•˜๊ธฐ ๊ด€๋ จ api ์—ฐ๊ฒฐ
  • ์ฐœํ•œ ์•ฝ์† ๋ฆฌ์ŠคํŠธ ์ฝ”๋“œ ๋ฆฌํŒฉํ† ๋ง, ์ˆ˜์ •

โœ… Checklist

PR

  • Branch Convention ํ™•์ธ

    feat/ ํ”ผ์ณ, fix/ ๋ฒ„๊ทธ ์ˆ˜์ •, refactor/ ๊ฐœ์„ 

  • Base Branch ํ™•์ธ
  • ์ ์ ˆํ•œ Label ์ง€์ •
  • Assignee ๋ฐ Reviewer ์ง€์ •

Test

  • ๋กœ์ปฌ ์ž‘๋™ ํ™•์ธ

Summary by CodeRabbit

๋ฆด๋ฆฌ์Šค ๋…ธํŠธ

  • ์‹ ๊ทœ ๊ธฐ๋Šฅ

    • ์‚ฌ์šฉ์ž๊ฐ€ ๋ชจ์ž„์— ์ข‹์•„์š”๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ  ์ œ๊ฑฐํ•  ์ˆ˜ ์žˆ๋Š” ๊ธฐ๋Šฅ ์ถ”๊ฐ€.
    • ์ข‹์•„์š” ๋ชฉ๋ก์„ ํŽ˜์ด์ง€๋ณ„๋กœ ์กฐํšŒํ•  ์ˆ˜ ์žˆ๋Š” ๊ธฐ๋Šฅ ์ถ”๊ฐ€.
    • ๋กœ๊ทธ์ธ ๋ชจ๋‹ฌ์„ ํ†ตํ•ด ๋น„๋กœ๊ทธ์ธ ์‚ฌ์šฉ์ž์—๊ฒŒ ๋กœ๊ทธ์ธ ์š”์ฒญ.
    • ์ข‹์•„์š” ๋ฐ ์ข‹์•„์š” ์ทจ์†Œ ์‹œ ์‚ฌ์šฉ์ž์—๊ฒŒ ์•Œ๋ฆผ์„ ํ‘œ์‹œํ•˜๋Š” ๊ธฐ๋Šฅ ์ถ”๊ฐ€.
    • ์ƒˆ๋กœ์šด LikedList ๋ฐ LikedListPresenter ์ปดํฌ๋„ŒํŠธ๋กœ ์‚ฌ์šฉ์ž ์ธํ„ฐํŽ˜์ด์Šค ๊ฐœ์„ .
    • GatheringListSection ์ปดํฌ๋„ŒํŠธ์— ์ข‹์•„์š” ๋ฐ ์ข‹์•„์š” ์ทจ์†Œ ๊ธฐ๋Šฅ ํ†ตํ•ฉ.
    • GatheringCardCarousel ์ปดํฌ๋„ŒํŠธ์— ์‚ฌ์šฉ์ž ์ธ์ฆ ์ฒดํฌ ๊ธฐ๋Šฅ ์ถ”๊ฐ€.
  • ๋ฒ„๊ทธ ์ˆ˜์ •

    • ์˜ค๋ฅ˜ ๋ฐœ์ƒ ์‹œ ์‚ฌ์šฉ์ž์—๊ฒŒ ์ ์ ˆํ•œ ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€ ํ‘œ์‹œ.
    • ๋กœ๋”ฉ ๋ฐ ์˜ค๋ฅ˜ ์ƒํƒœ์— ๋Œ€ํ•œ ์ฒ˜๋ฆฌ ๊ฐœ์„ .

@coderabbitai
Copy link

coderabbitai bot commented Nov 14, 2024

Walkthrough

์ด ๋ณ€๊ฒฝ ์‚ฌํ•ญ์€ ์‚ฌ์šฉ์ž์˜ ์ข‹์•„์š” ํ•ญ๋ชฉ์„ ๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•œ ๋น„๋™๊ธฐ ํ•จ์ˆ˜๋“ค์„ ํฌํ•จํ•˜๋Š” liked-apis.ts ํŒŒ์ผ์„ ์ƒˆ๋กœ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. ๋˜ํ•œ, liked-queries.ts ํŒŒ์ผ์— ์ข‹์•„์š” ๋ชฉ๋ก์„ ๊ฐ€์ ธ์˜ค๋Š” ์ฟผ๋ฆฌ ํ›…์„ ์ถ”๊ฐ€ํ•˜๊ณ , gathering-list-section.tsx ์ปดํฌ๋„ŒํŠธ์—์„œ ์ข‹์•„์š” ๋ฐ ์ข‹์•„์š” ์ทจ์†Œ ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ•ฉ๋‹ˆ๋‹ค. my-favorite/page.tsx ํŒŒ์ผ์€ ์ข‹์•„์š” ๋ชฉ๋ก์„ ํ‘œ์‹œํ•˜๋„๋ก ์ˆ˜์ •๋˜๋ฉฐ, ์—ฌ๋Ÿฌ ์ปดํฌ๋„ŒํŠธ์™€ ํƒ€์ž… ์ •์˜๊ฐ€ ๋ณ€๊ฒฝ๋˜์–ด ์ƒˆ๋กœ์šด ์ข‹์•„์š” ๊ธฐ๋Šฅ์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.

Changes

ํŒŒ์ผ ๊ฒฝ๋กœ ๋ณ€๊ฒฝ ์š”์•ฝ
src/_apis/liked/liked-apis.ts getLikedList, addLike, removeLike ํ•จ์ˆ˜ ์ถ”๊ฐ€
src/_queries/liked/liked-queries.ts useGetLikedListQuery ํ•จ์ˆ˜ ์ถ”๊ฐ€
src/app/(crew)/crew/detail/[id]/_components/gathering-list-section.tsx handleLike, handleUnlike ํ•จ์ˆ˜ ์ถ”๊ฐ€, ๋กœ๊ทธ์ธ ๋ชจ๋‹ฌ ๋ฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ ์ถ”๊ฐ€
src/app/(crew)/my-favorite/page.tsx GatheringList ๋Œ€์‹  LikedList ์ปดํฌ๋„ŒํŠธ๋กœ ๋ณ€๊ฒฝ
src/app/api/test-api/route.ts ํŒŒ์ผ ์‚ญ์ œ
src/components/common/gathering-card/container.tsx onLike, onUnlike ์†์„ฑ ์ถ”๊ฐ€ ๋ฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ ๊ฐœ์„ 
src/components/common/modal/confirm-modal.tsx ๋ชจ๋‹ฌ ๊ตฌ์กฐ ๋ณ€๊ฒฝ ๋ฐ close ๋ฒ„ํŠผ ๋™์ž‘ ์ˆ˜์ •
src/components/gathering-list/gathering-card-carousel.tsx onLike, onUnlike, onShowLoginModal ์†์„ฑ ์ถ”๊ฐ€
src/components/gathering-list/gathering-list.stories.tsx LikedListPresenter๋กœ ๋ณ€๊ฒฝ, ์ƒˆ๋กœ์šด ์•ก์…˜ ํ•ธ๋“ค๋Ÿฌ ์ถ”๊ฐ€
src/components/gathering-list/gathering-list.tsx ํŒŒ์ผ ์‚ญ์ œ
src/components/gathering-list/liked-list-container.tsx LikedList ์ปดํฌ๋„ŒํŠธ ์ถ”๊ฐ€
src/components/gathering-list/liked-list-presenter.tsx LikedListPresenter ์ปดํฌ๋„ŒํŠธ ์ถ”๊ฐ€
src/types/gathering-data.d.ts GatheringDetailType, LikeGatheringType, GatheringResponseType ์ธํ„ฐํŽ˜์ด์Šค ์ถ”๊ฐ€ ๋ฐ ์ˆ˜์ •

Possibly related PRs

  • Hofix/index page : ํŒŒ์ผ์ƒ˜ํ”Œ ์ปดํฌ๋„ŒํŠธ ์ˆ˜์ •ย #88: GatheringList ์ปดํฌ๋„ŒํŠธ์˜ ์ˆ˜์ • ์‚ฌํ•ญ์œผ๋กœ, ์ข‹์•„์š” ๋ฐ ๋ชจ์ž„ ๋ชฉ๋ก ๊ด€๋ฆฌ์™€ ๊ด€๋ จ์ด ์žˆ์Šต๋‹ˆ๋‹ค.
  • Hotfix/๋กœ๊ทธ์ธํ•˜์ง€ ์•Š์€ ์‚ฌ์šฉ์ž ์ฒ˜๋ฆฌย #89: ๋ชจ์ž„ ๊ด€๋ จ ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•˜๊ธฐ ์ „ ์‚ฌ์šฉ์ž ์ธ์ฆ ํ™•์ธ์„ ๋„์ž…ํ•˜์—ฌ ์ข‹์•„์š” ๊ธฐ๋Šฅ๊ณผ ์—ฐ๊ฒฐ๋ฉ๋‹ˆ๋‹ค.
  • Feat/96/formย #97: ์–‘์‹ ๊ธฐ๋Šฅ์„ ํ–ฅ์ƒ์‹œ์ผœ ์ข‹์•„์š” ์ถ”๊ฐ€ ๋ฐ ์ œ๊ฑฐ์™€ ๊ด€๋ จ์ด ์žˆ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • Feat/98/crew api ์—ฐ๊ฒฐย #104: ํฌ๋ฃจ API์™€ ๊ด€๋ จ๋œ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์œผ๋กœ, ์ข‹์•„์š” ํ•ญ๋ชฉ๊ณผ ์—ฐ๊ฒฐ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • Feat/111/gathering apiย #120: ๋ชจ์ž„ ๊ด€๋ จ API๋ฅผ ์ถ”๊ฐ€ํ•˜์—ฌ ์ข‹์•„์š” ๋ชจ์ž„ ๊ด€๋ฆฌ์™€ ์ง์ ‘์ ์œผ๋กœ ๊ด€๋ จ์ด ์žˆ์Šต๋‹ˆ๋‹ค.
  • Feat/107/my gathering apiย #117: ๋ชจ์ž„ ์ฐธ์—ฌ ๊ด€๋ฆฌ API ์ถ”๊ฐ€๋กœ ์ข‹์•„์š” ๋ชจ์ž„๊ณผ ๊ด€๋ จ์ด ์žˆ์Šต๋‹ˆ๋‹ค.
  • ๋กœ๊ทธ์ธ/ํšŒ์›๊ฐ€์ž… APIย #122: ๋กœ๊ทธ์ธ ๋ฐ ํšŒ์›๊ฐ€์ž… API ๊ตฌํ˜„์œผ๋กœ, ์ข‹์•„์š” ํ•ญ๋ชฉ๊ณผ ๊ฐ„์ ‘์ ์œผ๋กœ ๊ด€๋ จ์ด ์žˆ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Suggested labels

fix

Suggested reviewers

  • yulrang
  • minkyung5x5
  • Rangbyeolang

๐Ÿฐ ์ƒˆ๋กœ์šด ์ข‹์•„์š” ๊ธฐ๋Šฅ์ด ์ƒ๊ฒผ์–ด์š”!
๋ชจ์ž„์„ ์ข‹์•„ํ•˜๋‹ˆ, ๋งˆ์Œ๋„ ๊ฐ€๋ฒผ์›Œ์š”.
ํด๋ฆญํ•˜๊ณ , ์ข‹์•„์š”๋ฅผ ๋ˆ„๋ฅด๋ฉด,
ํ–‰๋ณต์ด ๊ฐ€๋“ ์ฐจ์˜ค๋ฅด์ฃ !
๋กœ๊ทธ์ธ ํ›„์—, ํ•จ๊ป˜ ๋‚˜๋ˆ„์–ด์š”!
๐Ÿฅ•โœจ

Warning

Rate limit exceeded

@HaeJungg has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 3 minutes and 13 seconds before requesting another review.

โŒ› How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

๐Ÿšฆ How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 4317a4c and e82ff4c.

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)/crew/detail/[id]/_components/gathering-list-section.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.


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

@github-actions
Copy link

@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: 10

๐Ÿงน Outside diff range and nitpick comments (19)
src/app/(crew)/my-favorite/page.tsx (1)

1-1: import ๊ฒฝ๋กœ ๋‹จ์ˆœํ™” ์ œ์•ˆ

ํ˜„์žฌ import ๋ฌธ์—์„œ ์‚ฌ์šฉ ์ค‘์ธ @/src/components ๊ฒฝ๋กœ๋Š” @/components๋กœ ๋‹จ์ˆœํ™”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Š” ์ฝ”๋“œ์˜ ๊ฐ€๋…์„ฑ์„ ํ–ฅ์ƒ์‹œํ‚ค๊ณ  ๊ฒฝ๋กœ ๊ด€๋ฆฌ๋ฅผ ๋” ์šฉ์ดํ•˜๊ฒŒ ๋งŒ๋“ค ๊ฒƒ์ž…๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋ณ€๊ฒฝ์„ ์ œ์•ˆํ•ฉ๋‹ˆ๋‹ค:

-import LikedList from '@/src/components/gathering-list/liked-list-container';
+import LikedList from '@/components/gathering-list/liked-list-container';
src/_queries/liked/liked-queries.ts (1)

4-9: ์ฟผ๋ฆฌ ๊ตฌํ˜„์ด ์ž˜ ๋˜์—ˆ์œผ๋‚˜, ๋ช‡ ๊ฐ€์ง€ ๊ฐœ์„ ์‚ฌํ•ญ์„ ์ œ์•ˆ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

ํ˜„์žฌ ๊ตฌํ˜„์€ ๊ธฐ๋ณธ์ ์ธ ๊ธฐ๋Šฅ์„ ์ž˜ ์ˆ˜ํ–‰ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค๋งŒ, ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฐœ์„ ์‚ฌํ•ญ๋“ค์„ ๊ณ ๋ คํ•ด๋ณด์‹œ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค:

  1. ์—๋Ÿฌ ํƒ€์ž… ์ •์˜
  2. ์„ฑ๋Šฅ ์ตœ์ ํ™”๋ฅผ ์œ„ํ•œ staleTime ์„ค์ •
  3. ํŽ˜์ด์ง€๋„ค์ด์…˜ ๊ด€๋ จ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ ํƒ€์ž… ์ •์˜

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ฐœ์„ ํ•ด๋ณด์‹œ๋Š” ๊ฒƒ์€ ์–ด๋–จ๊นŒ์š”?:

+import { UseQueryOptions } from '@tanstack/react-query';
+
+interface LikedListResponse {
+  items: Array<any>; // TODO: ์‹ค์ œ ์•„์ดํ…œ ํƒ€์ž…์œผ๋กœ ๊ต์ฒด
+  meta: {
+    currentPage: number;
+    totalPages: number;
+  };
+}

-export function useGetLikedListQuery(page: number) {
+export function useGetLikedListQuery(
+  page: number,
+  options?: Omit<UseQueryOptions<LikedListResponse, Error>, 'queryKey' | 'queryFn'>
+) {
   return useQuery({
     queryKey: ['likedList', page],
     queryFn: () => getLikedList(page),
+    staleTime: 5 * 60 * 1000, // 5๋ถ„
+    ...options,
   });
 }
src/_apis/liked/liked-apis.ts (1)

4-15: ํŽ˜์ด์ง€ ํฌ๊ธฐ๋ฅผ ์ƒ์ˆ˜๋กœ ๋ถ„๋ฆฌํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

ํ˜„์žฌ ํŽ˜์ด์ง€ ํฌ๊ธฐ๊ฐ€ 6์œผ๋กœ ํ•˜๋“œ์ฝ”๋”ฉ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ ์ƒ์ˆ˜๋กœ ๋ถ„๋ฆฌํ•˜๋ฉด ์œ ์ง€๋ณด์ˆ˜์„ฑ์ด ํ–ฅ์ƒ๋  ๊ฒƒ์ž…๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ˆ˜์ •ํ•˜๋Š” ๊ฒƒ์„ ์ œ์•ˆํ•ฉ๋‹ˆ๋‹ค:

+const LIKED_LIST_PAGE_SIZE = 6;
+
 export async function getLikedList(page: number): Promise<GatheringResponseType> {
-  const url = `/api/liked/memberLikes?page=${page}&size=6`;
+  const url = `/api/liked/memberLikes?page=${page}&size=${LIKED_LIST_PAGE_SIZE}`;
src/components/gathering-list/liked-list-container.tsx (2)

3-8: import๋ฌธ์„ ํƒ€์ž…๋ณ„๋กœ ๊ตฌ์„ฑํ•˜๋Š” ๊ฒƒ์„ ์ถ”์ฒœ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

๋” ๋‚˜์€ ๊ฐ€๋…์„ฑ์„ ์œ„ํ•ด import๋ฌธ์„ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ทธ๋ฃนํ™”ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค:

  1. React ๊ด€๋ จ
  2. ๋‚ด๋ถ€ API/์ฟผ๋ฆฌ
  3. ์œ ํ‹ธ๋ฆฌํ‹ฐ
  4. ์ปดํฌ๋„ŒํŠธ

๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ˆ˜์ •ํ•ด๋ณด์„ธ์š”:

import { useState } from 'react';

+// Internal APIs and queries
import { addLike, removeLike } from '@/src/_apis/liked/liked-apis';
import { useGetLikedListQuery } from '@/src/_queries/liked/liked-queries';

+// Utilities
import { ApiError } from '@/src/utils/api';

+// Components
import Toast from '@/src/components/common/toast';
import LikedListPresenter from './liked-list-presenter';

10-12: ํƒ€์ž… ์•ˆ์ •์„ฑ ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

ํŽ˜์ด์ง€ ์ƒํƒœ์™€ ๋ฐ์ดํ„ฐ์— ๋Œ€ํ•œ ๋ช…์‹œ์ ์ธ ํƒ€์ž… ์ •์˜๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ํƒ€์ž…์„ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์„ ์ถ”์ฒœ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

-export default function LikedList() {
+export default function LikedList(): JSX.Element {
-  const [page, setPage] = useState(1);
+  const [page, setPage] = useState<number>(1);
src/components/gathering-list/liked-list-presenter.tsx (3)

6-12: ์ธํ„ฐํŽ˜์ด์Šค ๋ฌธ์„œํ™” ๊ฐœ์„  ์ œ์•ˆ

์ธํ„ฐํŽ˜์ด์Šค์˜ ๊ฐ ํ”„๋กœํผํ‹ฐ์— ๋Œ€ํ•œ JSDoc ๋ฌธ์„œ๋ฅผ ์ถ”๊ฐ€ํ•˜๋ฉด ์ปดํฌ๋„ŒํŠธ์˜ ์‚ฌ์šฉ์„ฑ๊ณผ ์œ ์ง€๋ณด์ˆ˜์„ฑ์ด ํ–ฅ์ƒ๋  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋ฌธ์„œํ™”๋ฅผ ์ถ”๊ฐ€ํ•ด๋ณด์„ธ์š”:

 interface LikedListPresenterProps {
+  /** ํŽ˜์ด์ง€๋„ค์ด์…˜๋œ ๋ชจ์ž„ ๋ฐ์ดํ„ฐ */
   gatheringData: GatheringResponseType;
+  /** ํŽ˜์ด์ง€ ๋ณ€๊ฒฝ ์‹œ ํ˜ธ์ถœ๋˜๋Š” ํ•ธ๋“ค๋Ÿฌ */
   onPageChange: (page: number) => void;
+  /** ์ข‹์•„์š” ์ถ”๊ฐ€ ์‹œ ํ˜ธ์ถœ๋˜๋Š” ํ•ธ๋“ค๋Ÿฌ */
   onLike: (gatheringId: number) => void;
+  /** ์ข‹์•„์š” ์ œ๊ฑฐ ์‹œ ํ˜ธ์ถœ๋˜๋Š” ํ•ธ๋“ค๋Ÿฌ */
   onUnlike: (gatheringId: number) => void;
+  /** ํ˜„์žฌ ํŽ˜์ด์ง€ ๋ฒˆํ˜ธ */
   page: number;
 }

23-41: ๊ทธ๋ฆฌ๋“œ ๋ ˆ์ด์•„์›ƒ ๊ด€๋ จ ๊ฐœ์„ ์‚ฌํ•ญ

  1. min-height ๊ฐ’์ด ํ•˜๋“œ์ฝ”๋”ฉ๋˜์–ด ์žˆ์–ด ์ฝ˜ํ…์ธ  ์–‘์— ๋”ฐ๋ผ ๋ ˆ์ด์•„์›ƒ ์ด์Šˆ๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  2. GatheringCard์˜ liked prop์ด ํ•ญ์ƒ true๋กœ ์„ค์ •๋˜์–ด ์žˆ๋Š”๋ฐ, ์ด๋Š” ๋ถˆํ•„์š”ํ•ด ๋ณด์ž…๋‹ˆ๋‹ค. ์ด๋ฏธ ์ข‹์•„์š” ๋ชฉ๋ก์ด๋ฏ€๋กœ ์ œ๊ฑฐํ•ด๋„ ๋  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.
-            liked

42-65: ํŽ˜์ด์ง€๋„ค์ด์…˜ ์Šคํƒ€์ผ ๊ตฌ์„ฑ ๊ฐœ์„  ์ œ์•ˆ

ํ˜„์žฌ Tailwind์™€ CSS-in-JS๊ฐ€ ํ˜ผ์šฉ๋˜์–ด ์žˆ์–ด ์Šคํƒ€์ผ ๊ด€๋ฆฌ๊ฐ€ ๋ณต์žกํ•ด ๋ณด์ž…๋‹ˆ๋‹ค. ์Šคํƒ€์ผ ์ •์˜๋ฅผ ์ƒ์ˆ˜๋กœ ๋ถ„๋ฆฌํ•˜๋ฉด ๊ฐ€๋…์„ฑ๊ณผ ์žฌ์‚ฌ์šฉ์„ฑ์ด ํ–ฅ์ƒ๋  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ์Šคํƒ€์ผ์„ ๋ถ„๋ฆฌํ•ด๋ณด์„ธ์š”:

const PAGINATION_STYLES = {
  classNames: {
    control: cn(
      'data-[active="true"]:text-blue-500 data-[active="true"]:font-bold',
      'border-none bg-transparent hover:bg-transparent',
    ),
  },
  styles: {
    control: {
      '&[data-active]': {
        backgroundColor: 'transparent',
        fontWeight: 'var(--pagination-active-font-weight)',
        color: 'var(--pagination-active-color)',
        boxShadow: 'none',
      },
    },
  },
} as const;

// ์‚ฌ์šฉ์‹œ
<Pagination
  total={totalPages}
  value={page}
  onChange={onPageChange}
  {...PAGINATION_STYLES}
  size="sm"
/>
src/app/(crew)/crew/detail/[id]/_components/gathering-list-section.tsx (2)

31-39: ์ฝ”๋“œ ์ค‘๋ณต์„ ์ œ๊ฑฐํ•˜๊ณ  ์—๋Ÿฌ ์ฒ˜๋ฆฌ๋ฅผ ํ†ตํ•ฉํ•ด ์ฃผ์„ธ์š”.

์ข‹์•„์š”/์ข‹์•„์š” ์ทจ์†Œ ํ•ธ๋“ค๋Ÿฌ์˜ ์—๋Ÿฌ ์ฒ˜๋ฆฌ ๋กœ์ง์ด ์ค‘๋ณต๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ณตํ†ต ์—๋Ÿฌ ์ฒ˜๋ฆฌ ํ•จ์ˆ˜๋ฅผ ๋งŒ๋“ค์–ด ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์„ ์ œ์•ˆ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

+const handleApiError = (action: string, error: unknown) => {
+  const baseMessage = action === 'like' ? '์ฐœํ•˜๊ธฐ' : '์ฐœํ•˜๊ธฐ ํ•ด์ œ';
+  if (error instanceof ApiError) {
+    Toast({ 
+      message: `${baseMessage}์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค. ์ž ์‹œ ํ›„ ๋‹ค์‹œ ์‹œ๋„ํ•ด ์ฃผ์„ธ์š”.`,
+      type: 'error' 
+    });
+  } else {
+    Toast({ 
+      message: '์˜ˆ๊ธฐ์น˜ ๋ชปํ•œ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.',
+      type: 'error' 
+    });
+  }
+};

 const handleLike = async (gatheringId: number) => {
   try {
     await addLike(gatheringId);
   } catch (error) {
-    if (error instanceof ApiError) {
-      Toast({ message: `์ฐœํ•˜๊ธฐ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค: ${error.message}`, type: 'error' });
-    }
+    handleApiError('like', error);
   }
 };

 const handleUnlike = async (gatheringId: number) => {
   try {
     await removeLike(gatheringId);
   } catch (error) {
-    if (error instanceof ApiError) {
-      Toast({ message: `์ฐœํ•˜๊ธฐ ํ•ด์ œ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค: ${error.message}`, type: 'error' });
-    }
+    handleApiError('unlike', error);
   }
 };

41-44: ํ˜„์žฌ ๊ฒฝ๋กœ ๊ฐ€์ ธ์˜ค๊ธฐ ๋ฐฉ์‹์„ ๊ฐœ์„ ํ•ด ์ฃผ์„ธ์š”.

window.location.href๋Š” ํด๋ผ์ด์–ธํŠธ ์‚ฌ์ด๋“œ์—์„œ๋งŒ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•˜๋ฉฐ, Next.js์˜ ๋ผ์šฐํŒ… ์‹œ์Šคํ…œ๊ณผ ์™„๋ฒฝํ•˜๊ฒŒ ํ˜ธํ™˜๋˜์ง€ ์•Š์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Next.js์˜ usePathname์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์„ ์ถ”์ฒœ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

+import { usePathname } from 'next/navigation';

 export default function GatheringListSection({ id }: GatheringListSectionProps) {
   const router = useRouter();
+  const pathname = usePathname();
 
   const handleLoginRedirect = () => {
-    const currentPath = window.location.href;
+    const currentPath = pathname;
     router.push(`/login?redirect=${encodeURIComponent(currentPath)}`);
   };
src/components/common/gathering-card/scheduled-gathering-card/container.tsx (3)

Line range hint 27-57: ๋”๋ฏธ ๋ฐ์ดํ„ฐ์—์„œ ๋ฏผ๊ฐํ•œ ์ •๋ณด ์ œ๊ฑฐ ํ•„์š”

๋”๋ฏธ ๋ฐ์ดํ„ฐ์— ์ด๋ฉ”์ผ๊ณผ ๊ฐ™์€ ๋ฏผ๊ฐํ•œ ๊ฐœ์ธ์ •๋ณด๊ฐ€ ํฌํ•จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ์‹ค์ œ ์ด๋ฉ”์ผ ์ฃผ์†Œ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋Œ€์‹  ๊ฐ€๋ช…์˜ ์ด๋ฉ”์ผ(์˜ˆ: [email protected])์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

-        email: '[email protected]',
+        email: '[email protected]',

26-26: API ํ†ตํ•ฉ ๊ตฌํ˜„ ์ œ์•ˆ

ํ˜„์žฌ TODO ์ฃผ์„๋“ค์ด API ํ†ตํ•ฉ๊ณผ ๊ด€๋ จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค:

  1. ๋ชจ๋‹ฌ ๋ฐ์ดํ„ฐ ์—ฐ๊ฒฐ
  2. ์ข‹์•„์š” ํ† ๊ธ€ ๋กœ์ง

PR์˜ ๋ชฉ์ ์— ๋งž๊ฒŒ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ตฌํ˜„์„ ์ œ์•ˆ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

  • useGetLikedListQuery๋ฅผ ํ™œ์šฉํ•œ ์ข‹์•„์š” ์ƒํƒœ ๊ด€๋ฆฌ
  • ๋ชจ๋‹ฌ ๋ฐ์ดํ„ฐ๋Š” useQuery๋ฅผ ํ†ตํ•œ ์‹ค์‹œ๊ฐ„ ๋ฐ์ดํ„ฐ ํŒจ์นญ

API ํ†ตํ•ฉ ๊ตฌํ˜„์— ๋Œ€ํ•œ ์ƒ์„ธํ•œ ์ฝ”๋“œ ์˜ˆ์‹œ๊ฐ€ ํ•„์š”ํ•˜์‹œ๋‹ค๋ฉด ๋ง์”€ํ•ด ์ฃผ์„ธ์š”.

Also applies to: 65-65, 75-75


Line range hint 71-89: ์ปดํฌ๋„ŒํŠธ ๊ตฌ์กฐ ๊ฐœ์„  ์ œ์•ˆ

ํ˜„์žฌ ๊ตฌํ˜„์— ๋Œ€ํ•ด ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฐœ์„ ์‚ฌํ•ญ์„ ์ œ์•ˆ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

  1. ์—๋Ÿฌ ์ฒ˜๋ฆฌ ์ถ”๊ฐ€
  2. ๋ชจ๋‹ฌ ์ƒํƒœ ๊ด€๋ฆฌ ์ตœ์ ํ™”
  3. ๋ฐ์ดํ„ฐ ๋กœ๋”ฉ ์ƒํƒœ ์ฒ˜๋ฆฌ

๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ตฌ์กฐ๋กœ ๊ฐœ์„ ํ•˜๋Š” ๊ฒƒ์„ ์ถ”์ฒœ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

const handleCardClick = useCallback(() => {
  try {
    setIsOpened(true);
    // ๋ฐ์ดํ„ฐ ํŒจ์นญ ๋กœ์ง
  } catch (error) {
    console.error('๋ชจ๋‹ฌ ๋ฐ์ดํ„ฐ ๋กœ๋”ฉ ์ค‘ ์˜ค๋ฅ˜:', error);
    // ์—๋Ÿฌ ์ฒ˜๋ฆฌ ๋กœ์ง
  }
}, []);

// ๋กœ๋”ฉ ์ƒํƒœ ํ‘œ์‹œ
{isLoading ? (
  <LoadingSpinner />
) : dummyModalData && (
  <GatheringDetailModalContainer
    opened={isOpened}
    close={() => setIsOpened(false)}
    data={dummyModalData}
  />
)}
src/components/common/gathering-card/container.tsx (1)

48-60: ์ข‹์•„์š” ํ† ๊ธ€ ํ•ธ๋“ค๋Ÿฌ์˜ ์‚ฌ์šฉ์ž ๊ฒฝํ—˜ ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

ํ˜„์žฌ ๊ตฌํ˜„์€ ๊ธฐ๋Šฅ์ ์œผ๋กœ๋Š” ๋ฌธ์ œ๊ฐ€ ์—†์œผ๋‚˜, ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฐœ์„ ์‚ฌํ•ญ์„ ์ œ์•ˆ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

  1. ๋‚™๊ด€์  ์—…๋ฐ์ดํŠธ(Optimistic Update)๋ฅผ ํ†ตํ•œ ์ฆ‰๊ฐ์ ์ธ UI ๋ฐ˜์‘
  2. ์ค‘๋ณต ํด๋ฆญ ๋ฐฉ์ง€๋ฅผ ์œ„ํ•œ ๋กœ๋”ฉ ์ƒํƒœ ์ถ”๊ฐ€
  3. ๋” ๊ตฌ์ฒด์ ์ธ ์—๋Ÿฌ ๋ฉ”์‹œ์ง€ ์ฒ˜๋ฆฌ

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ฐœ์„ ํ•ด๋ณด์‹œ๋Š” ๊ฒƒ์€ ์–ด๋–จ๊นŒ์š”?:

+ const [isLoading, setIsLoading] = useState(false);
  const handleLikeToggle = async () => {
+   if (isLoading) return;
+   setIsLoading(true);
+   const newLikedState = !isLiked;
+   setIsLiked(newLikedState); // ๋‚™๊ด€์  ์—…๋ฐ์ดํŠธ
    try {
-     if (isLiked) {
+     if (!newLikedState) {
        await onUnlike(id);
-       setIsLiked(false);
      } else {
        await onLike(id);
-       setIsLiked(true);
      }
    } catch (error) {
+     setIsLiked(!newLikedState); // ์‹คํŒจ์‹œ ์›๋ž˜ ์ƒํƒœ๋กœ ๋ณต๊ตฌ
      Toast({
-       message: '์ฐœ ์ƒํƒœ๋ฅผ ์—…๋ฐ์ดํŠธํ•˜๋Š” ๋ฐ ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค.',
+       message: `์ฐœํ•˜๊ธฐ ${newLikedState ? '์ถ”๊ฐ€' : '์‚ญ์ œ'}์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค. ๋‹ค์‹œ ์‹œ๋„ํ•ด ์ฃผ์„ธ์š”.`,
        type: 'error'
      });
+   } finally {
+     setIsLoading(false);
    }
  };
src/app/(crew)/crew/_components/gathering-detail-modal/gathering-detail-modal.stories.tsx (1)

์ข‹์•„์š” ๊ธฐ๋Šฅ ๊ตฌํ˜„์ด ๋ฏธ์™„์„ฑ ์ƒํƒœ์ž…๋‹ˆ๋‹ค

์ฝ”๋“œ๋ฒ ์ด์Šค ๋ถ„์„ ๊ฒฐ๊ณผ, ํ˜„์žฌ ์ข‹์•„์š” ๊ด€๋ จ ๊ธฐ๋Šฅ์ด ์™„์ „ํžˆ ๊ตฌํ˜„๋˜์ง€ ์•Š์€ ๊ฒƒ์œผ๋กœ ํ™•์ธ๋ฉ๋‹ˆ๋‹ค:

  • ์Šคํ† ๋ฆฌ๋ถ์—์„œ๋Š” liked: false ์ƒํƒœ๊ฐ’๋งŒ ์ •์˜๋˜์–ด ์žˆ์Œ
  • ์ข‹์•„์š” ๋ชฉ๋ก์„ ์กฐํšŒํ•˜๋Š” API๋งŒ ๊ตฌํ˜„๋˜์–ด ์žˆ๊ณ  (getLikedList), ์ข‹์•„์š”/์ข‹์•„์š” ์ทจ์†Œ ๊ธฐ๋Šฅ์€ ์•„์ง ๊ตฌํ˜„๋˜์ง€ ์•Š์Œ
  • ๋ชจ๋‹ฌ ์ปดํฌ๋„ŒํŠธ์—์„œ ์ข‹์•„์š” ์ƒํƒœ๋ฅผ ์ฒ˜๋ฆฌํ•˜๋Š” ๋กœ์ง์ด ์—†์Œ
๐Ÿ”— Analysis chain

Line range hint 58-187: ์ข‹์•„์š” API์™€์˜ ์—ฐ๋™ ํ™•์ธ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

๊ฐ ์Šคํ† ๋ฆฌ์˜ ๋ฐ์ดํ„ฐ์— liked: false๊ฐ€ ์„ค์ •๋˜์–ด ์žˆ๋Š”๋ฐ, ์ด๊ฒƒ์ด ์ƒˆ๋กœ ์ถ”๊ฐ€๋œ ์ข‹์•„์š” API์™€ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์—ฐ๋™๋˜๋Š”์ง€ ํ™•์ธ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.


Let me gather more information about the liked functionality implementation.


Let me check one more thing to see if there are any liked-related APIs in the codebase.

๐Ÿ Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: ์ข‹์•„์š” API ๊ด€๋ จ ์ปดํฌ๋„ŒํŠธ์™€์˜ ์—ฐ๋™ ํ™•์ธ

# ์ข‹์•„์š” API ๊ด€๋ จ ํŒŒ์ผ ๊ฒ€์ƒ‰
echo "์ข‹์•„์š” API ๊ด€๋ จ ํŒŒ์ผ ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ:"
rg -l "liked-apis"

# GatheringDetailModalContainer์—์„œ ์ข‹์•„์š” API ์‚ฌ์šฉ ์—ฌ๋ถ€ ํ™•์ธ
echo "\nGatheringDetailModalContainer์˜ ์ข‹์•„์š” API ์‚ฌ์šฉ ํ™•์ธ:"
ast-grep --pattern 'import { $_ } from "$_/liked-apis"' ./src/app/\(crew\)/crew/_components/gathering-detail-modal/container.tsx

Length of output: 467


Script:

#!/bin/bash
# Check the implementation of liked functionality in the modal component and container

# Check modal component implementation
echo "Modal component liked implementation:"
rg -A 5 "liked" ./src/app/\(crew\)/crew/_components/gathering-detail-modal/gathering-detail-modal.tsx

# Check container implementation for liked state handling
echo "\nContainer liked state handling:"
rg -A 5 "liked" ./src/app/\(crew\)/crew/_components/gathering-detail-modal/container.tsx

# Check liked API implementation
echo "\nLiked API implementation:"
rg -A 5 "liked" ./src/_queries/liked/liked-queries.ts

Length of output: 812


Script:

#!/bin/bash
# Check liked API implementations and usages

# Check liked API endpoints
echo "Liked API endpoints:"
rg -A 5 "liked-apis" ./src/_apis

# Check if there are any like/unlike mutation implementations
echo "\nLike/Unlike mutations:"
rg -A 5 "mutation.*like" 

Length of output: 169

src/components/gathering-list/gathering-card-carousel.tsx (2)

11-16: ์ธํ„ฐํŽ˜์ด์Šค ๋ฌธ์„œํ™” ๊ฐœ์„  ํ•„์š”

์ƒˆ๋กœ ์ถ”๊ฐ€๋œ props์— ๋Œ€ํ•œ JSDoc ๋ฌธ์„œํ™”๋ฅผ ์ถ”๊ฐ€ํ•˜๋ฉด ์ปดํฌ๋„ŒํŠธ์˜ ์‚ฌ์šฉ์„ฑ์ด ํ–ฅ์ƒ๋  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋ฌธ์„œํ™”๋ฅผ ์ถ”๊ฐ€ํ•ด๋ณด์„ธ์š”:

 interface GatheringCardCarouselProps {
   gatheringData: GatheringType[];
   crewId: number;
+  /** ๋ชจ์ž„ ์ข‹์•„์š” ์ฒ˜๋ฆฌ ํ•ธ๋“ค๋Ÿฌ */
   onLike: (gatheringId: number) => Promise<void>;
+  /** ๋ชจ์ž„ ์ข‹์•„์š” ์ทจ์†Œ ์ฒ˜๋ฆฌ ํ•ธ๋“ค๋Ÿฌ */
   onUnlike: (gatheringId: number) => Promise<void>;
+  /** ๋กœ๊ทธ์ธ ๋ชจ๋‹ฌ ํ‘œ์‹œ ํ•ธ๋“ค๋Ÿฌ */
   onShowLoginModal: () => void;
 }

30-32: ์ธ์ฆ ๋กœ์ง ๋ฆฌํŒฉํ† ๋ง ์ œ์•ˆ

์ธ์ฆ ์ƒํƒœ ํ™•์ธ ๋กœ์ง์„ ๋” ์žฌ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•˜๊ฒŒ ๋งŒ๋“ค๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

์ปค์Šคํ…€ ํ›…์œผ๋กœ ๋ถ„๋ฆฌํ•˜๋Š” ๊ฒƒ์„ ๊ณ ๋ คํ•ด๋ณด์„ธ์š”:

// hooks/useAuth.ts
export const useAuth = () => {
  const token = useAuthStore((state) => state.token);
  return {
    isLoggedIn: !!token,
    token
  };
};

์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ๋‹ค๋ฅธ ์ปดํฌ๋„ŒํŠธ์—์„œ๋„ ๋™์ผํ•œ ์ธ์ฆ ๋กœ์ง์„ ์‰ฝ๊ฒŒ ์žฌ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

src/components/gathering-list/gathering-list.stories.tsx (2)

1-8: QueryClient ์„ค์ •์— ํƒ€์ž… ์•ˆ์ „์„ฑ ์ถ”๊ฐ€ ๊ถŒ์žฅ

QueryClient์˜ ๊ธฐ๋ณธ ์„ค์ •์ด ๋ˆ„๋ฝ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ํƒ€์ž… ์•ˆ์ „์„ฑ๊ณผ ์ผ๊ด€๋œ ๋™์ž‘์„ ๋ณด์žฅํ•˜๊ธฐ ์œ„ํ•ด defaultOptions์„ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด QueryClient๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” ๊ฒƒ์„ ์ถ”์ฒœ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

-const queryClient = new QueryClient();
+const queryClient = new QueryClient({
+  defaultOptions: {
+    queries: {
+      retry: 1,
+      refetchOnWindowFocus: false,
+    },
+  },
+});

32-227: ํ…Œ์ŠคํŠธ ๋ฐ์ดํ„ฐ์˜ ๋‹ค์–‘์„ฑ ๊ฐœ์„  ํ•„์š”

๋ชจ๋“  ๋ชจ์ž„ ๋ฐ์ดํ„ฐ๊ฐ€ ๋™์ผํ•œ ์ด๋ฏธ์ง€ URL์„ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ๋‹ค์–‘ํ•œ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๋ฅผ ์œ„ํ•ด ๋‹ค์Œ ์‚ฌํ•ญ๋“ค์„ ๊ณ ๋ คํ•ด๋ณด์„ธ์š”:

  • ๋‹ค์–‘ํ•œ ์ด๋ฏธ์ง€ URL ์‚ฌ์šฉ
  • ๊ณผ๊ฑฐ ๋‚ ์งœ ํฌํ•จ
  • ๋งˆ๊ฐ๋œ ๋ชจ์ž„ ์ผ€์ด์Šค
  • ์ตœ๋Œ€ ์ธ์›์ด ๋‹ค์–‘ํ•œ ์ผ€์ด์Šค
๐Ÿ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 243dc0d and 84a8539.

๐Ÿ“’ Files selected for processing (15)
  • src/_apis/liked/liked-apis.ts (1 hunks)
  • src/_queries/liked/liked-queries.ts (1 hunks)
  • src/app/(crew)/crew/_components/gathering-detail-modal/gathering-detail-modal.stories.tsx (3 hunks)
  • src/app/(crew)/crew/detail/[id]/_components/gathering-list-section.tsx (2 hunks)
  • src/app/(crew)/my-favorite/page.tsx (1 hunks)
  • src/app/api/test-api/route.ts (0 hunks)
  • src/components/common/gathering-card/container.tsx (3 hunks)
  • src/components/common/gathering-card/scheduled-gathering-card/container.tsx (1 hunks)
  • src/components/common/modal/confirm-modal.tsx (2 hunks)
  • src/components/gathering-list/gathering-card-carousel.tsx (3 hunks)
  • src/components/gathering-list/gathering-list.stories.tsx (1 hunks)
  • src/components/gathering-list/gathering-list.tsx (0 hunks)
  • src/components/gathering-list/liked-list-container.tsx (1 hunks)
  • src/components/gathering-list/liked-list-presenter.tsx (1 hunks)
  • src/types/gathering-data.d.ts (2 hunks)
๐Ÿ’ค Files with no reviewable changes (2)
  • src/app/api/test-api/route.ts
  • src/components/gathering-list/gathering-list.tsx
๐Ÿ”‡ Additional comments (15)
src/app/(crew)/my-favorite/page.tsx (1)

3-9: ์ปดํฌ๋„ŒํŠธ ๊ตฌํ˜„ ๊ฒ€์ฆ ํ•„์š”

์ปดํฌ๋„ŒํŠธ๊ฐ€ ๋‹จ์ˆœํ™”๋˜์–ด ์ข‹์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ LikedList ์ปดํฌ๋„ŒํŠธ์— props๊ฐ€ ์ „๋‹ฌ๋˜์ง€ ์•Š๋Š” ๊ฒƒ์ด ์˜๋„๋œ ๊ฒƒ์ธ์ง€ ํ™•์ธ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

๋‹ค์Œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•˜์—ฌ LikedList ์ปดํฌ๋„ŒํŠธ์˜ props ์š”๊ตฌ์‚ฌํ•ญ์„ ํ™•์ธํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค:

โœ… Verification successful

LikedList ์ปดํฌ๋„ŒํŠธ ๊ตฌํ˜„์ด ์ ์ ˆํ•จ์„ ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค

LikedList๋Š” ์ปจํ…Œ์ด๋„ˆ ์ปดํฌ๋„ŒํŠธ๋กœ์„œ ๋‚ด๋ถ€์ ์œผ๋กœ ํ•„์š”ํ•œ ์ƒํƒœ์™€ ๋ฐ์ดํ„ฐ๋ฅผ ๊ด€๋ฆฌํ•˜๊ณ  ์žˆ์–ด props๊ฐ€ ํ•„์š”ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋‹ค์Œ ์‚ฌํ•ญ๋“ค์ด ํ™•์ธ๋˜์—ˆ์Šต๋‹ˆ๋‹ค:

  • ์ปจํ…Œ์ด๋„ˆ(LikedList)๊ฐ€ ํŽ˜์ด์ง€ ์ƒํƒœ์™€ ๋ฐ์ดํ„ฐ fetching์„ ๊ด€๋ฆฌ
  • Presenter(LikedListPresenter)์— ํ•„์š”ํ•œ props๋ฅผ ์ „๋‹ฌ
  • React Query๋ฅผ ํ†ตํ•œ ๋ฐ์ดํ„ฐ ๊ด€๋ฆฌ๊ฐ€ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ๊ตฌํ˜„
๐Ÿ Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify LikedList component props requirements

# Check the component implementation
ast-grep --pattern 'interface $props {
  $$$
}' components/gathering-list/liked-list-container.tsx

# Check for required props usage
rg -A 5 'LikedList.*=' components/gathering-list/liked-list-container.tsx

Length of output: 365


Script:

#!/bin/bash
# Let's first find the LikedList component file
fd LikedList

# Then check its implementation and props
rg -A 10 "export.*LikedList"

# Also search for any interface or type definitions related to LikedList
ast-grep --pattern 'interface $props {
  $$$
}'

# Additional search for any props being used within LikedList
rg -A 5 "props\." 

Length of output: 3854

src/_queries/liked/liked-queries.ts (2)

1-2: ํ•„์š”ํ•œ ์˜์กด์„ฑ๋งŒ ์ •ํ™•ํ•˜๊ฒŒ ๊ฐ€์ ธ์˜ค๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

ํ•„์ˆ˜์ ์ธ useQuery์™€ getLikedList API๋งŒ importํ•˜์—ฌ ๊น”๋”ํ•˜๊ฒŒ ๊ตฌํ˜„๋˜์—ˆ์Šต๋‹ˆ๋‹ค.


6-6: ์ฟผ๋ฆฌ ํ‚ค๊ฐ€ ์ ์ ˆํžˆ ๊ตฌ์„ฑ๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

ํ˜„์žฌ queryKey๊ฐ€ ['likedList', page]๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ๋Š”๋ฐ, ๋‹ค๋ฅธ ๊ณณ์—์„œ ๋™์ผํ•œ ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์ง€ ์•Š์€์ง€ ํ™•์ธ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

โœ… Verification successful

Let me check the actual usage of the queryKey by looking at the content of the file.


์ฟผ๋ฆฌ ํ‚ค ์‚ฌ์šฉ์ด ์ ์ ˆํ•ฉ๋‹ˆ๋‹ค

'likedList' ์ฟผ๋ฆฌ ํ‚ค๋Š” ํ•ด๋‹น ํŒŒ์ผ์—์„œ๋งŒ ์œ ์ผํ•˜๊ฒŒ ์‚ฌ์šฉ๋˜๊ณ  ์žˆ์œผ๋ฉฐ, ํŽ˜์ด์ง€ ํŒŒ๋ผ๋ฏธํ„ฐ์™€ ํ•จ๊ป˜ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ๊ตฌ์„ฑ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ๋‹ค๋ฅธ ํŒŒ์ผ์—์„œ ๋™์ผํ•œ ์ฟผ๋ฆฌ ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š์•„ ์บ์‹œ ์ถฉ๋Œ์˜ ์œ„ํ—˜์ด ์—†์Šต๋‹ˆ๋‹ค.

๐Ÿ Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: ๋™์ผํ•œ ์ฟผ๋ฆฌ ํ‚ค ์‚ฌ์šฉ ์—ฌ๋ถ€ ํ™•์ธ

# likedList ์ฟผ๋ฆฌ ํ‚ค ์‚ฌ์šฉ ๊ฒ€์ƒ‰
rg -l "queryKey.*likedList" --type ts

Length of output: 75


Script:

#!/bin/bash
# Check the actual implementation of the query key usage
rg "queryKey.*likedList" -A 5 --type ts

Length of output: 267

src/_apis/liked/liked-apis.ts (1)

1-3: ํ•„์š”ํ•œ ์˜์กด์„ฑ๋“ค์ด ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ž„ํฌํŠธ๋˜์—ˆ์Šต๋‹ˆ๋‹ค!

ํƒ€์ž…๊ณผ ์œ ํ‹ธ๋ฆฌํ‹ฐ ํ•จ์ˆ˜๊ฐ€ ์ ์ ˆํ•˜๊ฒŒ ์ž„ํฌํŠธ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

src/components/common/modal/confirm-modal.tsx (2)

39-39: ๋‹ซ๊ธฐ ๋ฒ„ํŠผ ์ œ๊ฑฐ๋กœ UX ๊ฐœ์„ 

ํ™•์ธ ๋ชจ๋‹ฌ์˜ ํŠน์„ฑ์ƒ ์‚ฌ์šฉ์ž๊ฐ€ ๋ช…์‹œ์ ์œผ๋กœ ์„ ํƒํ•ด์•ผ ํ•˜๋Š” ์ƒํ™ฉ์—์„œ ๋‹ซ๊ธฐ ๋ฒ„ํŠผ์„ ์ œ๊ฑฐํ•œ ๊ฒƒ์€ ์ ์ ˆํ•œ ํŒ๋‹จ์ž…๋‹ˆ๋‹ค. ์‹ค์ˆ˜๋กœ ๋ชจ๋‹ฌ์ด ๋‹ซํžˆ๋Š” ๊ฒƒ์„ ๋ฐฉ์ง€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.


49-50: ๋ชจ๋‹ฌ ๋ ˆ์ด์•„์›ƒ ๊ตฌ์กฐ ๊ฐœ์„ 

์ผ๊ด€๋œ ํŒจ๋”ฉ(p-4)๊ณผ ์ค‘์•™ ์ •๋ ฌ(text-center)์„ ์ ์šฉํ•˜๊ณ , ์ ์ ˆํ•œ ๊ฐ„๊ฒฉ(space-y-8)์„ ์ถ”๊ฐ€ํ•œ ๊ฒƒ์€ ์ข‹์€ ๊ฐœ์„ ์ž…๋‹ˆ๋‹ค. ๋ ˆ์ด์•„์›ƒ์ด ๋” ๊น”๋”ํ•˜๊ณ  ์œ ์ง€๋ณด์ˆ˜๊ฐ€ ์šฉ์ดํ•ด์กŒ์Šต๋‹ˆ๋‹ค.

src/types/gathering-data.d.ts (1)

15-15: LGTM! crewId ํ•„๋“œ ์ถ”๊ฐ€

GatheringDetailType์— crewId ํ•„๋“œ๊ฐ€ ์ ์ ˆํ•˜๊ฒŒ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

src/components/gathering-list/liked-list-presenter.tsx (1)

14-21: ๊ตฌํ˜„์ด ๊น”๋”ํ•ด ๋ณด์ž…๋‹ˆ๋‹ค!

์ปดํฌ๋„ŒํŠธ ์„ ์–ธ๊ณผ props ๊ตฌ์กฐ๋ถ„ํ•ด๊ฐ€ React ๋ชจ๋ฒ” ์‚ฌ๋ก€๋ฅผ ์ž˜ ๋”ฐ๋ฅด๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

src/app/(crew)/crew/detail/[id]/_components/gathering-list-section.tsx (3)

3-9: ๊ฐ€์ ธ์˜ค๊ธฐ(import) ๊ตฌ๋ฌธ์ด ์ž˜ ๊ตฌ์„ฑ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค!

ํ•„์š”ํ•œ ๋ชจ๋“  ์˜์กด์„ฑ์ด ๋ช…ํ™•ํ•˜๊ฒŒ ์ •์˜๋˜์–ด ์žˆ์œผ๋ฉฐ, ๊ด€๋ จ ๊ธฐ๋Šฅ๋ณ„๋กœ ์ž˜ ๊ตฌ์„ฑ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.


18-19: ์ƒํƒœ ๊ด€๋ฆฌ๊ฐ€ ์ ์ ˆํ•˜๊ฒŒ ๊ตฌํ˜„๋˜์—ˆ์Šต๋‹ˆ๋‹ค!

๋ชจ๋‹ฌ ์ƒํƒœ์™€ ๋ผ์šฐํ„ฐ๊ฐ€ ๋ช…ํ™•ํ•˜๊ฒŒ ์ •์˜๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.


51-70: ๋ Œ๋”๋ง ๋กœ์ง์ด ๊น”๋”ํ•˜๊ฒŒ ๊ตฌํ˜„๋˜์—ˆ์Šต๋‹ˆ๋‹ค!

๋ชจ๋‹ฌ๊ณผ ์บ๋Ÿฌ์…€ ์ปดํฌ๋„ŒํŠธ์˜ ํ†ตํ•ฉ์ด ์ž˜ ๋˜์–ด์žˆ๊ณ , props ์ „๋‹ฌ์ด ๋ช…ํ™•ํ•ฉ๋‹ˆ๋‹ค.

src/components/common/gathering-card/container.tsx (2)

15-16: ์ข‹์•„์š” ๊ธฐ๋Šฅ์„ ์œ„ํ•œ ์ธํ„ฐํŽ˜์ด์Šค ํ™•์žฅ์ด ์ ์ ˆํžˆ ๊ตฌํ˜„๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

๋น„๋™๊ธฐ ํ•จ์ˆ˜ ํƒ€์ž…์ด ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ •์˜๋˜์–ด ์žˆ์œผ๋ฉฐ, ๋งค๊ฐœ๋ณ€์ˆ˜ ํƒ€์ž…๋„ ์ ์ ˆํ•ฉ๋‹ˆ๋‹ค.


30-31: ์ปดํฌ๋„ŒํŠธ props ํ†ตํ•ฉ์ด ์ž˜ ๋˜์–ด์žˆ์Šต๋‹ˆ๋‹ค.

์ธํ„ฐํŽ˜์ด์Šค์—์„œ ์ •์˜๋œ props๊ฐ€ ์ปดํฌ๋„ŒํŠธ์— ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ „๋‹ฌ๋˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

src/app/(crew)/crew/_components/gathering-detail-modal/gathering-detail-modal.stories.tsx (1)

58-58: ๋ชจ๋“  ์Šคํ† ๋ฆฌ์— crewId๊ฐ€ ์ผ๊ด€๋˜๊ฒŒ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

๊ฐ ์Šคํ† ๋ฆฌ์˜ ๋ฐ์ดํ„ฐ ๊ฐ์ฒด์— crewId: 1์ด ์ ์ ˆํ•˜๊ฒŒ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ด๋Š” ์ข‹์•„์š” API ์—ฐ๋™์„ ์œ„ํ•œ ํ•„์ˆ˜ ๋ฐ์ดํ„ฐ๋กœ ๋ณด์ž…๋‹ˆ๋‹ค.

Also applies to: 101-101, 144-144

src/components/gathering-list/gathering-list.stories.tsx (1)

9-23: ๋ฉ”ํƒ€ ๊ตฌ์„ฑ์ด ์ ์ ˆํ•ฉ๋‹ˆ๋‹ค

์Šคํ† ๋ฆฌ๋ถ ๋ฉ”ํƒ€ ๊ตฌ์„ฑ์ด ์ž˜ ๋˜์–ด์žˆ์œผ๋ฉฐ, QueryClientProvider ๋ฐ์ฝ”๋ ˆ์ดํ„ฐ๊ฐ€ ์ ์ ˆํžˆ ์„ค์ •๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

Comment on lines 40 to 61
if (isLoading) return <div>๋กœ๋”ฉ์ค‘...</div>;

// ์—๋Ÿฌ ์ฒ˜๋ฆฌ: error ๋˜๋Š” gatheringData๊ฐ€ undefined์ผ ๊ฒฝ์šฐ
if (error || gatheringData === undefined) {
Toast({ message: '์ข‹์•„์š” ๋ชฉ๋ก ๊ฐ€์ ธ์˜ค๊ธฐ ์‹คํŒจ', type: 'error' });
return <div>์ข‹์•„์š” ๋ชฉ๋ก ๊ฐ€์ ธ์˜ค๊ธฐ ์‹คํŒจ</div>;
}

// ๋นˆ ๋ฐฐ์—ด ์ฒ˜๋ฆฌ(์ข‹์•„์š” ๋ชฉ๋ก์ด ์—†๋Š” ๊ฒฝ์šฐ)
if (gatheringData.content.length === 0) {
return <div>์ข‹์•„์š” ๋ˆ„๋ฅธ ๋ชฉ๋ก์ด ์—†์Šต๋‹ˆ๋‹ค</div>;
}

return (
<LikedListPresenter
gatheringData={gatheringData}
onPageChange={handlePageChange}
onLike={handleLike}
onUnlike={handleUnlike}
page={page}
/>
);
Copy link

Choose a reason for hiding this comment

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

๐Ÿ› ๏ธ Refactor suggestion

์‚ฌ์šฉ์ž ๊ฒฝํ—˜ ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

ํ˜„์žฌ ๋กœ๋”ฉ ๋ฐ ์—๋Ÿฌ ์ƒํƒœ์˜ UI๊ฐ€ ๋„ˆ๋ฌด ๋‹จ์ˆœํ•ฉ๋‹ˆ๋‹ค. ๋” ๋‚˜์€ ์‚ฌ์šฉ์ž ๊ฒฝํ—˜์„ ์œ„ํ•ด ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค:

  1. ๋กœ๋”ฉ ์ƒํƒœ์— ์Šค์ผˆ๋ ˆํ†ค UI ๋˜๋Š” ์Šคํ”ผ๋„ˆ ์ถ”๊ฐ€
  2. ์—๋Ÿฌ ์ƒํƒœ์— ์žฌ์‹œ๋„ ๋ฒ„ํŠผ ์ถ”๊ฐ€
  3. ๋นˆ ์ƒํƒœ์— ๋Œ€ํ•œ ๋” ์นœ๊ทผํ•œ ๋ฉ”์‹œ์ง€์™€ ๊ฐ€์ด๋“œ ์ œ๊ณต

๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ˆ˜์ •ํ•˜๋Š” ๊ฒƒ์„ ์ถ”์ฒœ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

-  if (isLoading) return <div>๋กœ๋”ฉ์ค‘...</div>;
+  if (isLoading) return <LoadingSpinner />;

   if (error || gatheringData === undefined) {
     Toast({ message: '์ข‹์•„์š” ๋ชฉ๋ก ๊ฐ€์ ธ์˜ค๊ธฐ ์‹คํŒจ', type: 'error' });
-    return <div>์ข‹์•„์š” ๋ชฉ๋ก ๊ฐ€์ ธ์˜ค๊ธฐ ์‹คํŒจ</div>;
+    return (
+      <ErrorState
+        message="์ข‹์•„์š” ๋ชฉ๋ก์„ ๋ถˆ๋Ÿฌ์˜ค๋Š”๋ฐ ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค"
+        onRetry={() => refetch()}
+      />
+    );
   }

   if (gatheringData.content.length === 0) {
-    return <div>์ข‹์•„์š” ๋ˆ„๋ฅธ ๋ชฉ๋ก์ด ์—†์Šต๋‹ˆ๋‹ค</div>;
+    return (
+      <EmptyState
+        message="์•„์ง ์ข‹์•„์š”๋ฅผ ๋ˆ„๋ฅธ ๋ชจ์ž„์ด ์—†์Šต๋‹ˆ๋‹ค"
+        description="๊ด€์‹ฌ์žˆ๋Š” ๋ชจ์ž„์„ ์ฐพ์•„๋ณด์„ธ์š”!"
+        actionButton={
+          <Link href="/gatherings">๋ชจ์ž„ ๋‘˜๋Ÿฌ๋ณด๊ธฐ</Link>
+        }
+      />
+    );
   }

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

Comment on lines 89 to 107
<GatheringCard
crewId={crewId}
{...card}
className="w-full"
onLike={() => {
if (isLoggedIn) {
return onLike(card.id);
}
onShowLoginModal(); // ๋กœ๊ทธ์ธ์ด ์•ˆ ๋˜์–ด ์žˆ์œผ๋ฉด ๋ชจ๋‹ฌ ํ‘œ์‹œ
return Promise.resolve();
}}
onUnlike={() => {
if (isLoggedIn) {
return onUnlike(card.id);
}
onShowLoginModal(); // ๋กœ๊ทธ์ธ์ด ์•ˆ ๋˜์–ด ์žˆ์œผ๋ฉด ๋ชจ๋‹ฌ ํ‘œ์‹œ
return Promise.resolve();
}}
/>
Copy link

Choose a reason for hiding this comment

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

๐Ÿ› ๏ธ Refactor suggestion

์ข‹์•„์š”/์ข‹์•„์š” ์ทจ์†Œ ํ•ธ๋“ค๋Ÿฌ ์ค‘๋ณต ์ฝ”๋“œ ๊ฐœ์„  ํ•„์š”

onLike์™€ onUnlike ํ•ธ๋“ค๋Ÿฌ์˜ ๊ตฌ์กฐ๊ฐ€ ๋งค์šฐ ์œ ์‚ฌํ•˜์—ฌ ์ค‘๋ณต ์ฝ”๋“œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ณตํ†ต ๋กœ์ง์„ ์ถ”์ถœํ•˜์—ฌ ๋ฆฌํŒฉํ† ๋งํ•˜๋Š” ๊ฒƒ์„ ์ถ”์ฒœ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

const createAuthenticatedHandler = (
  handler: (id: number) => Promise<void>
) => (id: number) => {
  if (isLoggedIn) {
    return handler(id);
  }
  onShowLoginModal();
  return Promise.resolve();
};

<GatheringCard
  crewId={crewId}
  {...card}
  className="w-full"
  onLike={createAuthenticatedHandler((id) => onLike(id))}
  onUnlike={createAuthenticatedHandler((id) => onUnlike(id))}
/>

์ด๋ ‡๊ฒŒ ํ•˜๋ฉด:

  1. ์ฝ”๋“œ ์ค‘๋ณต์ด ์ œ๊ฑฐ๋ฉ๋‹ˆ๋‹ค
  2. ์ธ์ฆ ๋กœ์ง์ด ํ•œ ๊ณณ์—์„œ ๊ด€๋ฆฌ๋ฉ๋‹ˆ๋‹ค
  3. ํ–ฅํ›„ ์ธ์ฆ ๊ด€๋ จ ๋กœ์ง ๋ณ€๊ฒฝ ์‹œ ์œ ์ง€๋ณด์ˆ˜๊ฐ€ ์šฉ์ดํ•ฉ๋‹ˆ๋‹ค

Copy link
Contributor

@yulrang yulrang left a comment

Choose a reason for hiding this comment

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

ํ† ๋ผ๊ฐ€ ์ถ”์ฒœํ•ด์ค€๋ฐฉ๋ฒ•๋„ ๊ณ ๋ฏผํ•ด์„œ ์‹œ๊ฐ„๋‚ ๋•Œ ์ ์šฉํ•ด๋ณด์‹œ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”~~~
์ˆ˜๊ณ  ๋งŽ์œผ์…จ์Šต๋‹ˆ๋‹ค~!

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

๐Ÿงน Outside diff range and nitpick comments (14)
src/_queries/liked/liked-queries.ts (1)

4-9: ์—๋Ÿฌ ์ฒ˜๋ฆฌ์™€ ์žฌ์‹œ๋„ ์„ค์ •์„ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์ด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค.

์‚ฌ์šฉ์ž ๊ฒฝํ—˜ ํ–ฅ์ƒ์„ ์œ„ํ•ด ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์„ค์ •์„ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์„ ๊ณ ๋ คํ•ด๋ณด์„ธ์š”:

  • ์—๋Ÿฌ ๋ฐœ์ƒ ์‹œ ์žฌ์‹œ๋„ ํšŸ์ˆ˜
  • ์บ์‹œ ์œ ํšจ ์‹œ๊ฐ„
  • ์—๋Ÿฌ ๋ฐœ์ƒ ์‹œ ํด๋ฐฑ UI๋ฅผ ์œ„ํ•œ ์—๋Ÿฌ ์ฒ˜๋ฆฌ

๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ˆ˜์ •ํ•˜๋Š” ๊ฒƒ์„ ์ œ์•ˆํ•ฉ๋‹ˆ๋‹ค:

 export function useGetLikedListQuery(page: number) {
   return useQuery({
     queryKey: ['likedList', page],
     queryFn: () => getLikedList(page),
+    retry: 1,
+    staleTime: 5 * 60 * 1000, // 5๋ถ„
+    onError: (error) => {
+      console.error('์ข‹์•„์š” ๋ชฉ๋ก์„ ๋ถˆ๋Ÿฌ์˜ค๋Š”๋ฐ ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค:', error);
+    }
   });
 }
src/components/gathering-list/liked-list-container.tsx (1)

1-9: ๊ฒฝ๋กœ ๋ณ„์นญ(@/src)์˜ ์ค‘๋ณต ์‚ฌ์šฉ์„ ํ™•์ธํ•ด์ฃผ์„ธ์š”.

import ๊ตฌ๋ฌธ์—์„œ @/src๊ฐ€ ์ค‘๋ณต์ ์œผ๋กœ ์‚ฌ์šฉ๋˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Š” ์œ ์ง€๋ณด์ˆ˜์„ฑ์„ ์ €ํ•˜์‹œํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ˆ˜์ •ํ•˜๋Š” ๊ฒƒ์„ ๊ณ ๋ คํ•ด๋ณด์„ธ์š”:

-import { addLike, removeLike } from '@/src/_apis/liked/liked-apis';
-import { useGetLikedListQuery } from '@/src/_queries/liked/liked-queries';
-import { ApiError } from '@/src/utils/api';
-import Toast from '@/src/components/common/toast';
+import { addLike, removeLike } from '@/_apis/liked/liked-apis';
+import { useGetLikedListQuery } from '@/_queries/liked/liked-queries';
+import { ApiError } from '@/utils/api';
+import Toast from '@/components/common/toast';
src/components/gathering-list/liked-list-presenter.tsx (3)

21-21: ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” ๋ณ€์ˆ˜๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค

pageSize ๋ณ€์ˆ˜๋ฅผ ๊ตฌ์กฐ ๋ถ„ํ•ดํ–ˆ์ง€๋งŒ ์ปดํฌ๋„ŒํŠธ ๋‚ด์—์„œ ์‚ฌ์šฉ๋˜์ง€ ์•Š๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ํ•„์š”ํ•˜์ง€ ์•Š๋‹ค๋ฉด ์ œ๊ฑฐํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

-  const { content, pageSize, totalPages } = gatheringData;
+  const { content, totalPages } = gatheringData;

47-62: ์Šคํƒ€์ผ๋ง ๋ฐฉ์‹์˜ ์ผ๊ด€์„ฑ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค

Pagination ์ปดํฌ๋„ŒํŠธ์˜ ์Šคํƒ€์ผ๋ง์— Tailwind(classNames)์™€ CSS-in-JS(styles)๊ฐ€ ํ˜ผ์šฉ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ์œ ์ง€๋ณด์ˆ˜์„ฑ์„ ์œ„ํ•ด ํ•œ ๊ฐ€์ง€ ๋ฐฉ์‹์œผ๋กœ ํ†ต์ผํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

์˜ˆ๋ฅผ ๋“ค์–ด, Tailwind๋งŒ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ์‹:

          classNames={{
            control: cn(
              'data-[active="true"]:text-blue-500 data-[active="true"]:font-bold',
              'border-none bg-transparent hover:bg-transparent',
+             'shadow-none'
            ),
          }}
-          styles={{
-            control: {
-              '&[data-active]': {
-                backgroundColor: 'transparent',
-                fontWeight: 'var(--pagination-active-font-weight)',
-                color: 'var(--pagination-active-color)',
-                boxShadow: 'none',
-              },
-            },
-          }}

29-29: min-height ๊ฐ’์˜ ๊ทผ๊ฑฐ๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค

md:min-h-[962px]์™€ lg:min-h-[636px] ๊ฐ’์ด ๋งค์ง ๋„˜๋ฒ„์ฒ˜๋Ÿผ ๋ณด์ž…๋‹ˆ๋‹ค. ์ด ๊ฐ’๋“ค์˜ ๊ณ„์‚ฐ ๊ทผ๊ฑฐ๋ฅผ ์ฃผ์„์œผ๋กœ ์ถ”๊ฐ€ํ•˜๊ฑฐ๋‚˜, ์˜๋ฏธ ์žˆ๋Š” ๋ณ€์ˆ˜๋กœ ์ถ”์ถœํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

          'grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3',
          'mx-auto justify-items-center gap-4',
-          'md:min-h-[962px] lg:min-h-[636px]',
+          // ์นด๋“œ ๋†’์ด(300px) * ํ–‰ ์ˆ˜(2) + ๊ฐ„๊ฒฉ(16px) * (ํ–‰ ์ˆ˜ - 1) = 616px
+          'md:min-h-[616px]',
+          // ์นด๋“œ ๋†’์ด(300px) * ํ–‰ ์ˆ˜(2) + ๊ฐ„๊ฒฉ(16px) * (ํ–‰ ์ˆ˜ - 1) = 616px
+          'lg:min-h-[616px]',
src/app/(crew)/crew/detail/[id]/_components/gathering-list-section.tsx (2)

46-48: TODO ์ฃผ์„์„ ํ•ด๊ฒฐํ•ด์ฃผ์„ธ์š”.

๋กœ๋”ฉ๊ณผ ์—๋Ÿฌ ์ƒํƒœ์— ๋Œ€ํ•œ UI ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

๋” ๋‚˜์€ ๋กœ๋”ฉ ๋ฐ ์—๋Ÿฌ UI ๊ตฌํ˜„์„ ๋„์™€๋“œ๋ฆด๊นŒ์š”? ์Šค์ผˆ๋ ˆํ†ค ๋กœ๋”ฉ์ด๋‚˜ ์—๋Ÿฌ ๋ฐ”์šด๋”๋ฆฌ ๊ตฌํ˜„์„ ์ œ์•ˆ๋“œ๋ฆด ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.


51-70: ๋ชจ๋‹ฌ ์ƒํƒœ ๊ด€๋ฆฌ ๋กœ์ง์ด ๊ฐœ์„ ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋ชจ๋‹ฌ์˜ ์—ด๋ฆผ/๋‹ซํž˜ ์ƒํƒœ๊ฐ€ ์ค‘๋ณต๋˜์–ด ๊ด€๋ฆฌ๋˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. opened prop์ด ๋ถˆํ•„์š”ํ•ด ๋ณด์ž…๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ˆ˜์ •์„ ์ œ์•ˆํ•ฉ๋‹ˆ๋‹ค:

  {showLoginModal && (
    <ConfirmModal
-     opened={showLoginModal}
      onClose={() => setShowLoginModal(false)}
      onConfirm={handleLoginRedirect}
    >
      ๋กœ๊ทธ์ธ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค!
    </ConfirmModal>
  )}
src/components/common/gathering-card/scheduled-gathering-card/container.tsx (3)

Line range hint 27-65: ๋”๋ฏธ ๋ฐ์ดํ„ฐ๋ฅผ ์‹ค์ œ API ์‘๋‹ต ํƒ€์ž…์œผ๋กœ ๊ต์ฒดํ•ด์ฃผ์„ธ์š”.

๋”๋ฏธ ๋ฐ์ดํ„ฐ๋Š” ๊ฐœ๋ฐœ ๋‹จ๊ณ„์—์„œ๋Š” ์œ ์šฉํ•˜์ง€๋งŒ, ํ”„๋กœ๋•์…˜ ํ™˜๊ฒฝ์—์„œ๋Š” ์‹ค์ œ API ์‘๋‹ต์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค. ๋‹ค์Œ ์‚ฌํ•ญ๋“ค์„ ๊ณ ๋ คํ•ด์ฃผ์„ธ์š”:

  1. API ์‘๋‹ต ํƒ€์ž…์„ ์ •์˜ํ•˜๊ณ  ๋”๋ฏธ ๋ฐ์ดํ„ฐ๋ฅผ ํ•ด๋‹น ํƒ€์ž…์œผ๋กœ ๊ฒ€์ฆ
  2. ์‹ค์ œ API ์—ฐ๋™ ์‹œ ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜์ด ์šฉ์ดํ•˜๋„๋ก ์ธํ„ฐํŽ˜์ด์Šค ๊ตฌ์กฐํ™”
interface Participant {
  id: number;
  profileImageUrl: string;
  nickname: string;
  email: string;
}

interface GatheringDetailType {
  crewId: number;
  id: number;
  title: string;
  // ... ๋‚˜๋จธ์ง€ ํ•„๋“œ๋“ค
  participants: Participant[];
}

26-26: TODO ํ•ญ๋ชฉ๋“ค์˜ ๊ตฌํ˜„์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

ํ˜„์žฌ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ตฌํ˜„์ด ๋ˆ„๋ฝ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค:

  1. ๋ชจ๋‹ฌ ๋ฐ์ดํ„ฐ ์—ฐ๊ฒฐ
  2. useQuery ์žฌ์‹œ๋„ ๋กœ์ง
  3. ์ข‹์•„์š” ํ† ๊ธ€ ๊ธฐ๋Šฅ

์ด๋Ÿฌํ•œ ๊ธฐ๋Šฅ๋“ค์˜ ๊ตฌํ˜„์„ ๋„์™€๋“œ๋ฆด๊นŒ์š”? GitHub ์ด์Šˆ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ๊ฐ TODO ํ•ญ๋ชฉ์„ ์ถ”์ ํ•˜๊ณ  ๊ตฌํ˜„ ๊ฐ€์ด๋“œ๋ฅผ ์ œ๊ณตํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Also applies to: 73-73, 78-78


Line range hint 16-24: ์ปดํฌ๋„ŒํŠธ ๊ตฌ์กฐ ๊ฐœ์„ ์„ ์œ„ํ•œ ์ œ์•ˆ์‚ฌํ•ญ

ํ˜„์žฌ ๊ตฌ์กฐ๋Š” ์ž˜ ์ž‘์„ฑ๋˜์–ด ์žˆ์ง€๋งŒ, ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฐœ์„ ์‚ฌํ•ญ์„ ๊ณ ๋ คํ•ด๋ณด์„ธ์š”:

  1. ์—๋Ÿฌ ๋ฐ”์šด๋”๋ฆฌ ์ถ”๊ฐ€
  2. ๋กœ๋”ฉ ์ƒํƒœ ์ฒ˜๋ฆฌ
  3. ๋ชจ๋‹ฌ ์ƒํƒœ ๊ด€๋ฆฌ๋ฅผ ์ „์—ญ ์ƒํƒœ๋กœ ์ด๋™ ๊ณ ๋ ค
// ์—๋Ÿฌ ๋ฐ”์šด๋”๋ฆฌ ์˜ˆ์‹œ
try {
  // ๊ธฐ์กด ๋ Œ๋”๋ง ๋กœ์ง
} catch (error) {
  return <ErrorComponent error={error} />;
}

// ๋กœ๋”ฉ ์ƒํƒœ ์ฒ˜๋ฆฌ ์˜ˆ์‹œ
{isLoading ? (
  <LoadingSpinner />
) : (
  <ScheduledGatheringCardPresenter
    data={data}
    onClick={handleCardClick}
    onLikeToggle={handleLikeToggle}
  />
)}

Also applies to: 69-91

src/app/(crew)/crew/_components/gathering-detail-modal/gathering-detail-modal.stories.tsx (1)

Line range hint 58-187: ํ…Œ์ŠคํŠธ ๋ฐ์ดํ„ฐ ์ค‘๋ณต ๊ฐœ์„  ์ œ์•ˆ

ํ˜„์žฌ ์„ธ ๊ฐœ์˜ ์Šคํ† ๋ฆฌ๊ฐ€ ๋งค์šฐ ์œ ์‚ฌํ•œ ํ…Œ์ŠคํŠธ ๋ฐ์ดํ„ฐ๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ฝ”๋“œ์˜ ์œ ์ง€๋ณด์ˆ˜์„ฑ์„ ๋†’์ด๊ธฐ ์œ„ํ•ด ๊ณตํ†ต ๋ฐ์ดํ„ฐ๋ฅผ ๋ถ„๋ฆฌํ•˜๋Š” ๊ฒƒ์„ ๊ณ ๋ คํ•ด๋ณด์„ธ์š”.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ฐœ์„ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

+const BASE_GATHERING_DATA = {
+  crewId: 1,
+  introduce: '๊ณต์ง€์‚ฌํ•ญ์ž…๋‹ˆ๋‹ค. ๋‹ค๋“ค ์ด๋ฒˆ ์•ฝ์† ์žŠ์ง€ ์•Š์œผ์…จ์ฃ ? ๊ผญ ์ฐธ์—ฌ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค~',
+  location: '์„œ์šธ์‹œ ๊ฐ•๋‚จ๊ตฌ ์—ญ์‚ผ๋™ ์˜คํ”ผ์Šคํƒ€์›Œ 3์ธต',
+  currentCount: 3,
+  totalCount: 10,
+  imageUrl: 'https://www.dabur.com/Blogs/Doshas/Importance%20and%20Benefits%20of%20Yoga%201020x450.jpg',
+  participants: [
+    // ... ๊ธฐ์กด ์ฐธ๊ฐ€์ž ๋ฐ์ดํ„ฐ
+  ],
+};

 export const ModalWithUser = Template.bind({});
 ModalWithUser.args = {
   opened: false,
   data: {
-    crewId: 1,
-    // ... ๊ธฐ์กด ๋ฐ์ดํ„ฐ
+    ...BASE_GATHERING_DATA,
+    id: 1,
+    title: '์‹ ๋‚˜๋Š” ์šด๋™...์ฆ๊ฑฐ์šด..์ฝ”๋”ฉ..',
+    liked: false,
+    gatheringCaptain: false,
+    participant: false,
   },
 };
src/components/gathering-list/gathering-card-carousel.tsx (1)

30-32: ๋กœ๊ทธ์ธ ์ƒํƒœ ํ™•์ธ ๋กœ์ง์„ ์ปค์Šคํ…€ ํ›…์œผ๋กœ ๋ถ„๋ฆฌํ•˜๋Š” ๊ฒƒ์„ ๊ณ ๋ คํ•ด๋ณด์„ธ์š”.

ํ˜„์žฌ ๊ตฌํ˜„์€ ์ž˜ ์ž‘๋™ํ•˜์ง€๋งŒ, ์žฌ์‚ฌ์šฉ์„ฑ๊ณผ ๊ด€๋ฆฌ ์šฉ์ด์„ฑ์„ ์œ„ํ•ด ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฐœ์„ ์„ ์ œ์•ˆํ•ฉ๋‹ˆ๋‹ค:

+// src/hooks/use-auth.ts
+export const useAuth = () => {
+  const token = useAuthStore((state) => state.token);
+  return {
+    isLoggedIn: !!token,
+    token
+  };
+};

-const token = useAuthStore((state) => state.token);
-const isLoggedIn = !!token;
+const { isLoggedIn } = useAuth();
src/components/gathering-list/gathering-list.stories.tsx (2)

7-22: QueryClient ์„ค์ • ์ตœ์ ํ™” ํ•„์š”

ํ˜„์žฌ QueryClient๊ฐ€ ๊ธฐ๋ณธ ์„ค์ •์œผ๋กœ๋งŒ ์ƒ์„ฑ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. Storybook ํ™˜๊ฒฝ์— ๋งž๋Š” ์บ์‹ฑ ๋ฐ ์žฌ์‹œ๋„ ์„ค์ •์„ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด QueryClient ์„ค์ •์„ ์ตœ์ ํ™”ํ•˜๋Š” ๊ฒƒ์„ ์ถ”์ฒœ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

-const queryClient = new QueryClient();
+const queryClient = new QueryClient({
+  defaultOptions: {
+    queries: {
+      retry: false,
+      cacheTime: 0,
+      staleTime: Infinity,
+    },
+  },
+});

28-30: ์•ก์…˜ ํ•ธ๋“ค๋Ÿฌ์— ํƒ€์ž… ์•ˆ์ „์„ฑ ์ถ”๊ฐ€ ํ•„์š”

ํ˜„์žฌ ์•ก์…˜ ํ•ธ๋“ค๋Ÿฌ๋“ค์ด ํƒ€์ž… ์ •์˜ ์—†์ด ๊ตฌํ˜„๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ํƒ€์ž… ์•ˆ์ „์„ฑ์„ ์œ„ํ•ด ๋งค๊ฐœ๋ณ€์ˆ˜ ํƒ€์ž…์„ ๋ช…์‹œํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ํƒ€์ž…์„ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์„ ์ถ”์ฒœ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

-const onLike = action('onLike');
-const onUnlike = action('onUnlike');
-const onPageChange = action('onPageChange');
+const onLike = action<(id: number) => void>('onLike');
+const onUnlike = action<(id: number) => void>('onUnlike');
+const onPageChange = action<(page: number) => void>('onPageChange');
๐Ÿ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 243dc0d and 84a8539.

๐Ÿ“’ Files selected for processing (15)
  • src/_apis/liked/liked-apis.ts (1 hunks)
  • src/_queries/liked/liked-queries.ts (1 hunks)
  • src/app/(crew)/crew/_components/gathering-detail-modal/gathering-detail-modal.stories.tsx (3 hunks)
  • src/app/(crew)/crew/detail/[id]/_components/gathering-list-section.tsx (2 hunks)
  • src/app/(crew)/my-favorite/page.tsx (1 hunks)
  • src/app/api/test-api/route.ts (0 hunks)
  • src/components/common/gathering-card/container.tsx (3 hunks)
  • src/components/common/gathering-card/scheduled-gathering-card/container.tsx (1 hunks)
  • src/components/common/modal/confirm-modal.tsx (2 hunks)
  • src/components/gathering-list/gathering-card-carousel.tsx (3 hunks)
  • src/components/gathering-list/gathering-list.stories.tsx (1 hunks)
  • src/components/gathering-list/gathering-list.tsx (0 hunks)
  • src/components/gathering-list/liked-list-container.tsx (1 hunks)
  • src/components/gathering-list/liked-list-presenter.tsx (1 hunks)
  • src/types/gathering-data.d.ts (2 hunks)
๐Ÿ’ค Files with no reviewable changes (2)
  • src/app/api/test-api/route.ts
  • src/components/gathering-list/gathering-list.tsx
๐Ÿ”‡ Additional comments (15)
src/app/(crew)/my-favorite/page.tsx (2)

6-6: ๊ตฌํ˜„์ด ๊น”๋”ํ•ด ๋ณด์ž…๋‹ˆ๋‹ค!

LikedList ์ปดํฌ๋„ŒํŠธ๋กœ์˜ ๊ต์ฒด๊ฐ€ ์ž˜ ์ด๋ฃจ์–ด์กŒ์Šต๋‹ˆ๋‹ค. ์ปดํฌ๋„ŒํŠธ๊ฐ€ props ์—†์ด ๋…๋ฆฝ์ ์œผ๋กœ ๋™์ž‘ํ•˜๋„๋ก ์„ค๊ณ„๋œ ๊ฒƒ์ด ์ข‹์€ ์ ‘๊ทผ ๋ฐฉ์‹์œผ๋กœ ๋ณด์ž…๋‹ˆ๋‹ค.


1-1: ์ปดํฌ๋„ŒํŠธ ๊ฒฝ๋กœ ํ™•์ธ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

์ƒˆ๋กœ ์ถ”๊ฐ€๋œ LikedList ์ปดํฌ๋„ŒํŠธ์˜ ๊ฒฝ๋กœ๊ฐ€ ์˜ฌ๋ฐ”๋ฅธ์ง€ ํ™•์ธ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

๋‹ค์Œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•˜์—ฌ ์ปดํฌ๋„ŒํŠธ ํŒŒ์ผ์˜ ์กด์žฌ ์—ฌ๋ถ€๋ฅผ ํ™•์ธํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค:

โœ… Verification successful

์ปดํฌ๋„ŒํŠธ ๊ฒฝ๋กœ๊ฐ€ ์ •ํ™•ํ•˜๊ฒŒ ํ™•์ธ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

LikedList ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์˜ฌ๋ฐ”๋ฅธ ๊ฒฝ๋กœ์— ์กด์žฌํ•˜๋ฉฐ, ์ ์ ˆํ•˜๊ฒŒ ๊ตฌํ˜„๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ์ปดํฌ๋„ŒํŠธ๋Š” ์ข‹์•„์š” ๋ชฉ๋ก์„ ๊ด€๋ฆฌํ•˜๋Š” ๊ธฐ๋Šฅ์„ ํฌํ•จํ•˜๊ณ  ์žˆ์–ด ์˜๋„๋œ ์šฉ๋„์— ๋งž๊ฒŒ ๊ตฌํ˜„๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of the LikedList component

# Check if the component file exists
fd "liked-list-container.tsx" src/components/gathering-list

# Verify the component export
ast-grep --pattern 'export default function LikedList'

Length of output: 171


Script:

#!/bin/bash
# Let's verify the content of the LikedList component to ensure it's properly implemented
cat src/components/gathering-list/liked-list-container.tsx

Length of output: 1758

src/_queries/liked/liked-queries.ts (2)

1-9: ๊ตฌํ˜„์ด ๊น”๋”ํ•˜๊ณ  ๋ช…ํ™•ํ•ฉ๋‹ˆ๋‹ค!

React Query๋ฅผ ์‚ฌ์šฉํ•œ ๊ตฌํ˜„์ด ๊ฐ„๋‹จํ•˜๋ฉด์„œ๋„ ํšจ๊ณผ์ ์ž…๋‹ˆ๋‹ค.


6-6: queryKey๊ฐ€ ์ ์ ˆํžˆ ๊ตฌ์„ฑ๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

๋‹ค๋ฅธ ๊ณณ์—์„œ ๋™์ผํ•œ ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š”์ง€ ํ™•์ธํ•˜์—ฌ ์บ์‹œ ์ถฉ๋Œ์„ ๋ฐฉ์ง€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

โœ… Verification successful

queryKey ๊ตฌ์„ฑ์ด ์ ์ ˆํ•ฉ๋‹ˆ๋‹ค

'likedList' queryKey๋Š” ํ•ด๋‹น ํŒŒ์ผ์—์„œ๋งŒ ์‚ฌ์šฉ๋˜๊ณ  ์žˆ์œผ๋ฉฐ, page ํŒŒ๋ผ๋ฏธํ„ฐ์™€ ํ•จ๊ป˜ ์ ์ ˆํžˆ ๊ตฌ์„ฑ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ๋‹ค๋ฅธ ํŒŒ์ผ์—์„œ ๋™์ผํ•œ ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์—†์–ด ์บ์‹œ ์ถฉ๋Œ ์œ„ํ—˜์ด ์—†์Šต๋‹ˆ๋‹ค.

๐Ÿ Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for other usages of the 'likedList' query key
rg -l "queryKey.*['\"]likedList['\"]" --type ts

Length of output: 89


Script:

#!/bin/bash
# Let's check the content of the file to understand the context better
cat src/_queries/liked/liked-queries.ts

Length of output: 308


Script:

#!/bin/bash
# Let's check if there are any other files that might be using similar query patterns or mutations related to liked functionality
rg -l "queryKey.*liked" --type ts

# Also check for any mutations that might be affecting this query
rg -l "useMutation.*liked" --type ts

Length of output: 110

src/_apis/liked/liked-apis.ts (2)

1-3: LGTM! ํ•„์š”ํ•œ ์˜์กด์„ฑ๋“ค์ด ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ž„ํฌํŠธ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

ํ•„์š”ํ•œ ์œ ํ‹ธ๋ฆฌํ‹ฐ์™€ ํƒ€์ž…์ด ์ ์ ˆํ•˜๊ฒŒ ์ž„ํฌํŠธ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.


6-6: API ์—”๋“œํฌ์ธํŠธ ๊ฒ€์ฆ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

๋ฐฑ์—”๋“œ API ๋ฌธ์„œ์™€ ์ผ์น˜ํ•˜๋Š”์ง€ ๋‹ค์Œ ์—”๋“œํฌ์ธํŠธ๋“ค์„ ํ™•์ธํ•ด์ฃผ์„ธ์š”:

  • GET /api/liked/memberLikes
  • POST /api/liked/${gatheringId}
  • DELETE /api/liked/${gatheringId}

Also applies to: 19-19, 31-31

โœ… Verification successful

API ์—”๋“œํฌ์ธํŠธ ๊ตฌํ˜„์ด ์ผ๊ด€๋˜๊ฒŒ ๋˜์–ด์žˆ์Šต๋‹ˆ๋‹ค

์ฝ”๋“œ๋ฒ ์ด์Šค ๋ถ„์„ ๊ฒฐ๊ณผ, /api/liked ๊ด€๋ จ ์—”๋“œํฌ์ธํŠธ๋“ค์ด ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ผ๊ด€๋˜๊ฒŒ ๊ตฌํ˜„๋˜์–ด ์žˆ์Œ์„ ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค:

  • GET /api/liked/memberLikes - ์ฐœ ๋ชฉ๋ก ์กฐํšŒ (ํŽ˜์ด์ง€๋„ค์ด์…˜ ์ง€์›)
  • POST /api/liked/${gatheringId} - ์ฐœ ์ถ”๊ฐ€
  • DELETE /api/liked/${gatheringId} - ์ฐœ ์ œ๊ฑฐ

๊ฐ ์—”๋“œํฌ์ธํŠธ๋Š” fetchApi ์œ ํ‹ธ๋ฆฌํ‹ฐ๋ฅผ ํ†ตํ•ด ์ ์ ˆํ•œ HTTP ๋ฉ”์„œ๋“œ์™€ ํ—ค๋”๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ตฌํ˜„๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# API ๋ฌธ์„œ๋‚˜ ์ŠคํŽ™์„ ์ฐพ์•„ ์—”๋“œํฌ์ธํŠธ ๊ฒ€์ฆ
fd -e yaml -e json . | xargs grep -l "/api/liked"

Length of output: 49


Script:

#!/bin/bash
# API ์—”๋“œํฌ์ธํŠธ ์‚ฌ์šฉ ํŒจํ„ด ๊ฒ€์ƒ‰
rg -A 2 "/api/liked" --type ts

# API ๊ด€๋ จ ์„ค์ • ํŒŒ์ผ ๊ฒ€์ƒ‰
fd -e ts -e js "api|config|axios" | xargs cat

# Swagger/OpenAPI ๋ฌธ์„œ ๊ฒ€์ƒ‰
fd "swagger|openapi|api" -e yaml -e json

Length of output: 10689

src/components/common/modal/confirm-modal.tsx (2)

39-39: ๋ช…์‹œ์ ์ธ ๋‹ซ๊ธฐ ๋ฒ„ํŠผ ์ œ๊ฑฐ๊ฐ€ ์ ์ ˆํ•ด ๋ณด์ž…๋‹ˆ๋‹ค.

ํ™•์ธ ๋ชจ๋‹ฌ์˜ ํŠน์„ฑ์ƒ ์‚ฌ์šฉ์ž๊ฐ€ ๋ช…ํ™•ํ•œ ์„ ํƒ์„ ํ•ด์•ผ ํ•˜๋ฏ€๋กœ, ๋‹ซ๊ธฐ ๋ฒ„ํŠผ์„ ์ œ๊ฑฐํ•œ ๊ฒƒ์ด UX ๊ด€์ ์—์„œ ์ ์ ˆํ•ฉ๋‹ˆ๋‹ค. ์‹ค์ˆ˜๋กœ ๋ชจ๋‹ฌ์ด ๋‹ซํžˆ๋Š” ๊ฒƒ์„ ๋ฐฉ์ง€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.


49-50: ๋ชจ๋‹ฌ ๋‚ด๋ถ€ ๊ตฌ์กฐ ๊ฐœ์„ ์ด ์ž˜ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

ํŒจ๋”ฉ๊ณผ ์ƒˆ๋กœ์šด div ๋ž˜ํผ ์ถ”๊ฐ€๋กœ ๋ ˆ์ด์•„์›ƒ์ด ๋” ์ผ๊ด€๋˜๊ณ  ๊น”๋”ํ•ด์กŒ์Šต๋‹ˆ๋‹ค. space-y-8 ํด๋ž˜์Šค์™€ ํ•จ๊ป˜ ๋‚ด๋ถ€ ์š”์†Œ๋“ค์˜ ๊ฐ„๊ฒฉ์ด ์ž˜ ์กฐ์ ˆ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

src/types/gathering-data.d.ts (2)

15-15: LGTM: crewId ์†์„ฑ์ด ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

๋ชจ์ž„ ์ƒ์„ธ ์ •๋ณด์— crew ์‹๋ณ„์ž๋ฅผ ํฌํ•จํ•˜๋Š” ๊ฒƒ์ด ์ ์ ˆํ•ฉ๋‹ˆ๋‹ค.


63-69: โš ๏ธ Potential issue

GatheringContentType์ด ์ •์˜๋˜์ง€ ์•Š์€ ๋ฌธ์ œ ํ•ด๊ฒฐ ํ•„์š”

GatheringResponseType ์ธํ„ฐํŽ˜์ด์Šค์—์„œ ์‚ฌ์šฉํ•˜๋Š” GatheringContentType์ด ์ •์˜๋˜์–ด ์žˆ์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ด๋Š” ํƒ€์ž… ์˜ค๋ฅ˜๋ฅผ ๋ฐœ์ƒ์‹œํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ˆ˜์ •์„ ์ œ์•ˆ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

 export interface GatheringResponseType {
-  content: GatheringContentType[];
+  content: LikeGatheringType[];
   pageNumber: number;
   pageSize: number;
   totalElements: number;
   totalPages: number;
 }

Likely invalid or redundant comment.

src/components/gathering-list/liked-list-presenter.tsx (1)

1-12: ์ธํ„ฐํŽ˜์ด์Šค์™€ ์ž„ํฌํŠธ ์„ ์–ธ์ด ์ž˜ ์ •์˜๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค!

props ์ธํ„ฐํŽ˜์ด์Šค๊ฐ€ ๋ช…ํ™•ํ•˜๊ฒŒ ํƒ€์ž…์ด ์ง€์ •๋˜์–ด ์žˆ์œผ๋ฉฐ, ํ•„์š”ํ•œ ๋ชจ๋“  ์˜์กด์„ฑ์ด ์ ์ ˆํ•˜๊ฒŒ ์ž„ํฌํŠธ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

src/app/(crew)/crew/detail/[id]/_components/gathering-list-section.tsx (1)

41-44: ๋กœ๊ทธ์ธ ๋ฆฌ๋‹ค์ด๋ ‰์…˜ ๋กœ์ง์ด ์ ์ ˆํ•ฉ๋‹ˆ๋‹ค.

ํ˜„์žฌ ๊ฒฝ๋กœ๋ฅผ ํฌํ•จํ•œ ๋ฆฌ๋‹ค์ด๋ ‰์…˜ ์ฒ˜๋ฆฌ๊ฐ€ ์ž˜ ๊ตฌํ˜„๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

src/components/common/gathering-card/container.tsx (2)

15-16: ์ข‹์•„์š” ๊ธฐ๋Šฅ์„ ์œ„ํ•œ Props ํƒ€์ž… ์ •์˜๊ฐ€ ์ ์ ˆํ•ฉ๋‹ˆ๋‹ค.

Promise๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” ๋น„๋™๊ธฐ ํ•จ์ˆ˜๋กœ ์ •์˜๋˜์–ด ์žˆ์–ด API ํ˜ธ์ถœ์— ์ ํ•ฉํ•ฉ๋‹ˆ๋‹ค.


30-31: Props ๊ตฌ์กฐ ๋ถ„ํ•ด๊ฐ€ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ๊ตฌํ˜„๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

์ปดํฌ๋„ŒํŠธ์˜ ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ์ƒˆ๋กœ์šด props๊ฐ€ ์ ์ ˆํ•˜๊ฒŒ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

src/components/gathering-list/gathering-card-carousel.tsx (1)

11-16: ์ธํ„ฐํŽ˜์ด์Šค ๋ณ€๊ฒฝ์ด ์ž˜ ๊ตฌํ˜„๋˜์—ˆ์Šต๋‹ˆ๋‹ค!

์ข‹์•„์š” ๊ด€๋ จ ๊ธฐ๋Šฅ์„ ์œ„ํ•œ ์ฝœ๋ฐฑ ํ•จ์ˆ˜๋“ค์ด ๋ช…ํ™•ํ•˜๊ฒŒ ํƒ€์ž…์ด ์ง€์ •๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

Comment on lines +10 to +13
export default function LikedList() {
const [page, setPage] = useState(1);
const { data: gatheringData, isLoading, error, refetch } = useGetLikedListQuery(page);

Copy link

Choose a reason for hiding this comment

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

๐Ÿ› ๏ธ Refactor suggestion

ํƒ€์ž… ์•ˆ์ „์„ฑ ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

์ปดํฌ๋„ŒํŠธ์™€ ์ƒํƒœ์— ๋ช…์‹œ์ ์ธ ํƒ€์ž… ์ •์˜๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ํƒ€์ž…์„ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์„ ์ถ”์ฒœ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

-export default function LikedList() {
+export default function LikedList(): JSX.Element {
-  const [page, setPage] = useState(1);
+  const [page, setPage] = useState<number>(1);
๐Ÿ“ 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
export default function LikedList() {
const [page, setPage] = useState(1);
const { data: gatheringData, isLoading, error, refetch } = useGetLikedListQuery(page);
export default function LikedList(): JSX.Element {
const [page, setPage] = useState<number>(1);
const { data: gatheringData, isLoading, error, refetch } = useGetLikedListQuery(page);

Comment on lines 3 to 9
import { useState } from 'react';
import { useRouter } from 'next/navigation';
import { addLike, removeLike } from '@/src/_apis/liked/liked-apis';
import { useGetGatheringListQuery } from '@/src/_queries/detail/gathering-list-queries';
import { ApiError } from '@/src/utils/api';
import ConfirmModal from '@/src/components/common/modal/confirm-modal';
import Toast from '@/src/components/common/toast';
Copy link

Choose a reason for hiding this comment

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

๐Ÿ’ก Codebase verification

Toast ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์ž˜๋ชป๋œ ๋ฐฉ์‹์œผ๋กœ ์‚ฌ์šฉ๋˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค

Toast ์ปดํฌ๋„ŒํŠธ๋Š” React ์ปดํฌ๋„ŒํŠธ๋กœ ๊ตฌํ˜„๋˜์–ด ์žˆ์œผ๋‚˜, ํ˜„์žฌ ํ•จ์ˆ˜์ฒ˜๋Ÿผ ํ˜ธ์ถœ๋˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ˆ˜์ •์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค:

  • gathering-list-section.tsx์˜ Toast ํ˜ธ์ถœ ๋ถ€๋ถ„์„ JSX ๋ฌธ๋ฒ•์œผ๋กœ ๋ณ€๊ฒฝํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค:
{apiError instanceof ApiError && (
  <Toast message={`์ฐœํ•˜๊ธฐ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค: ${apiError.message}`} type="error" />
)}
  • ToastContainer๊ฐ€ ํŽ˜์ด์ง€์—์„œ ํ•œ ๋ฒˆ๋งŒ ๋ Œ๋”๋ง๋˜๋„๋ก ์ƒ์œ„ ๋ ˆ์ด์•„์›ƒ ์ปดํฌ๋„ŒํŠธ๋กœ ์ด๋™ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
๐Ÿ”— Analysis chain

๋ถˆํ•„์š”ํ•œ import ๊ตฌ๋ฌธ์ด ์žˆ๋Š”์ง€ ํ™•์ธ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

Toast ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์‹ค์ œ๋กœ ์‚ฌ์šฉ๋˜๋Š” ๋ฐฉ์‹์ด ์˜ฌ๋ฐ”๋ฅธ์ง€ ํ™•์ธํ•ด์ฃผ์„ธ์š”. React ์ปดํฌ๋„ŒํŠธ์ฒ˜๋Ÿผ ์‚ฌ์šฉ๋˜๊ณ  ์žˆ์ง€๋งŒ, ํ•จ์ˆ˜์ฒ˜๋Ÿผ ํ˜ธ์ถœ๋˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Toast ์ปดํฌ๋„ŒํŠธ์˜ ์ •์˜๋ฅผ ํ™•์ธ
ast-grep --pattern 'export $_ function Toast'

Length of output: 47


Script:

#!/bin/bash
# Toast ์ปดํฌ๋„ŒํŠธ์˜ ์ •์˜์™€ ์‚ฌ์šฉ ๋ฐฉ์‹์„ ํ™•์ธ
rg -A 5 "export.*Toast" 

Length of output: 1582


Script:

#!/bin/bash
# gathering-list-section.tsx ํŒŒ์ผ์—์„œ Toast์˜ ์‚ฌ์šฉ ๋ฐฉ์‹์„ ํ™•์ธ
rg -A 3 "Toast\." src/app/\(crew\)/crew/detail/\[id\]/_components/gathering-list-section.tsx

Length of output: 92


Script:

#!/bin/bash
# Toast ์ปดํฌ๋„ŒํŠธ ํŒŒ์ผ ์ฐพ๊ธฐ
fd -t f "toast" -I

Length of output: 64


Script:

#!/bin/bash
# gathering-list-section.tsx ํŒŒ์ผ์˜ ์ „์ฒด ๋‚ด์šฉ์„ ํ™•์ธํ•˜์—ฌ Toast ์‚ฌ์šฉ ๋ฐฉ์‹ ํŒŒ์•…
rg -l "Toast" src/app/\(crew\)/crew/detail/\[id\]/_components/gathering-list-section.tsx && cat src/app/\(crew\)/crew/detail/\[id\]/_components/gathering-list-section.tsx

Length of output: 2435


Script:

#!/bin/bash
# Toast ์ปดํฌ๋„ŒํŠธ์˜ ์ „์ฒด ๊ตฌํ˜„ ํ™•์ธ
cat src/components/common/toast/index.tsx

Length of output: 762

Comment on lines 48 to 60
// ์ฐœํ•˜๊ธฐ ์ƒํƒœ ์—…๋ฐ์ดํŠธ
const handleLikeToggle = async () => {
try {
if (isLiked) {
await onUnlike(id);
setIsLiked(false);
} else {
await onLike(id);
setIsLiked(true);
}
} catch (error) {
Toast({ message: '์ฐœ ์ƒํƒœ๋ฅผ ์—…๋ฐ์ดํŠธํ•˜๋Š” ๋ฐ ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค.', type: 'error' });
}
Copy link

Choose a reason for hiding this comment

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

๐Ÿ› ๏ธ Refactor suggestion

์ข‹์•„์š” ํ† ๊ธ€ ํ•ธ๋“ค๋Ÿฌ์˜ ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

ํ˜„์žฌ ๊ตฌํ˜„์—์„œ ๋‹ค์Œ ์‚ฌํ•ญ๋“ค์„ ๊ฐœ์„ ํ•˜๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค:

  1. ๋กœ๋”ฉ ์ƒํƒœ ๊ด€๋ฆฌ๊ฐ€ ์—†์–ด ์‚ฌ์šฉ์ž ํ”ผ๋“œ๋ฐฑ์ด ๋ถ€์กฑํ•ฉ๋‹ˆ๋‹ค.
  2. ๋น„๋™๊ธฐ ์ž‘์—… ์ค‘ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋Š” ๋ ˆ์ด์Šค ์ปจ๋””์…˜์— ์ทจ์•ฝํ•ฉ๋‹ˆ๋‹ค.
  3. ์—๋Ÿฌ ์ฒ˜๋ฆฌ๊ฐ€ ๋ชจ๋“  ์ผ€์ด์Šค๋ฅผ ํฌ๊ด„์ ์œผ๋กœ ๋‹ค๋ฃจ์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ฐœ์„ ํ•ด๋ณด์„ธ์š”:

+ const [isLoading, setIsLoading] = useState(false);
  const handleLikeToggle = async () => {
+   if (isLoading) return;
+   setIsLoading(true);
    try {
      if (isLiked) {
        await onUnlike(id);
-       setIsLiked(false);
+       setIsLiked(prev => !prev);
      } else {
        await onLike(id);
-       setIsLiked(true);
+       setIsLiked(prev => !prev);
      }
    } catch (error) {
+     // ์›๋ž˜ ์ƒํƒœ๋กœ ๋ณต๊ตฌ
+     setIsLiked(prev => !prev);
+     if (error instanceof Error) {
+       Toast({ message: `์ข‹์•„์š” ์—…๋ฐ์ดํŠธ ์‹คํŒจ: ${error.message}`, type: 'error' });
+     } else {
        Toast({ message: '์ฐœ ์ƒํƒœ๋ฅผ ์—…๋ฐ์ดํŠธํ•˜๋Š” ๋ฐ ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค.', type: 'error' });
+     }
    } finally {
+     setIsLoading(false);
    }
  };
๐Ÿ“ 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
// ์ฐœํ•˜๊ธฐ ์ƒํƒœ ์—…๋ฐ์ดํŠธ
const handleLikeToggle = async () => {
try {
if (isLiked) {
await onUnlike(id);
setIsLiked(false);
} else {
await onLike(id);
setIsLiked(true);
}
} catch (error) {
Toast({ message: '์ฐœ ์ƒํƒœ๋ฅผ ์—…๋ฐ์ดํŠธํ•˜๋Š” ๋ฐ ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค.', type: 'error' });
}
const [isLoading, setIsLoading] = useState(false);
const handleLikeToggle = async () => {
if (isLoading) return;
setIsLoading(true);
try {
if (isLiked) {
await onUnlike(id);
setIsLiked(prev => !prev);
} else {
await onLike(id);
setIsLiked(prev => !prev);
}
} catch (error) {
// ์›๋ž˜ ์ƒํƒœ๋กœ ๋ณต๊ตฌ
setIsLiked(prev => !prev);
if (error instanceof Error) {
Toast({ message: `์ข‹์•„์š” ์—…๋ฐ์ดํŠธ ์‹คํŒจ: ${error.message}`, type: 'error' });
} else {
Toast({ message: '์ฐœ ์ƒํƒœ๋ฅผ ์—…๋ฐ์ดํŠธํ•˜๋Š” ๋ฐ ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค.', type: 'error' });
}
} finally {
setIsLoading(false);
}
};

ModalWithUser.args = {
opened: false,
data: {
crewId: 1,
Copy link

Choose a reason for hiding this comment

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

๐Ÿ’ก Codebase verification

crewId ์†์„ฑ์ด stories์—๋งŒ ์ถ”๊ฐ€๋˜์–ด ์žˆ๊ณ  ์‹ค์ œ ์ปดํฌ๋„ŒํŠธ์—์„œ๋Š” ์‚ฌ์šฉ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค

๊ฒ€์ฆ ๊ฒฐ๊ณผ:

  • stories ํŒŒ์ผ์—์„œ๋งŒ crewId: 1 ์†์„ฑ์ด ์ถ”๊ฐ€๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค
  • container.tsx์™€ presenter.tsx์—์„œ GatheringDetailType ํƒ€์ž…์„ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์ง€๋งŒ, crewId๋ฅผ ์‹ค์ œ๋กœ ์‚ฌ์šฉํ•˜๋Š” ๋กœ์ง์€ ์—†์Šต๋‹ˆ๋‹ค
  • ์ข‹์•„์š” API ์—ฐ๋™์„ ์œ„ํ•ด ์ถ”๊ฐ€๋œ ์†์„ฑ์ด๋ผ๋ฉด, ๊ด€๋ จ ๊ธฐ๋Šฅ ๊ตฌํ˜„์ด ๋ˆ„๋ฝ๋œ ๊ฒƒ์œผ๋กœ ๋ณด์ž…๋‹ˆ๋‹ค
๐Ÿ”— Analysis chain

crewId ์†์„ฑ์ด ์ผ๊ด€๋˜๊ฒŒ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

๋ชจ๋“  ์Šคํ† ๋ฆฌ์— crewId: 1์ด ์ถ”๊ฐ€๋œ ๊ฒƒ์„ ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด๋Š” ์ข‹์•„์š” API ์—ฐ๋™์„ ์œ„ํ•œ ๋ณ€๊ฒฝ์‚ฌํ•ญ๊ณผ ์ž˜ ๋ถ€ํ•ฉํ•ฉ๋‹ˆ๋‹ค.

์ปดํฌ๋„ŒํŠธ์—์„œ ์ด ์†์„ฑ์ด ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์‚ฌ์šฉ๋˜๋Š”์ง€ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด ๋‹ค์Œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค:

Also applies to: 101-101, 144-144

๐Ÿ Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: GatheringDetailModalContainer ์ปดํฌ๋„ŒํŠธ์—์„œ crewId ์‚ฌ์šฉ ์—ฌ๋ถ€ ํ™•์ธ

# container.tsx ํŒŒ์ผ์—์„œ crewId ์‚ฌ์šฉ ํ™•์ธ
ast-grep --pattern 'interface GatheringDetailType {
  $$$
  crewId: number
  $$$
}'

# crewId๋ฅผ props๋กœ ์ „๋‹ฌํ•˜๋Š” ํŒจํ„ด ํ™•์ธ
ast-grep --pattern 'function GatheringDetailModalContainer({ $$$, data }: GatheringDetailModalContainerProps) {
  $$$
  crewId
  $$$
}'

Length of output: 223


Script:

#!/bin/bash
# ๋ชจ๋‹ฌ ์ปดํฌ๋„ŒํŠธ ํŒŒ์ผ์—์„œ crewId ์‚ฌ์šฉ ํŒจํ„ด ๊ฒ€์ƒ‰
rg -l "crewId" "src/app/(crew)/crew/_components/gathering-detail-modal/"

# ๋ชจ๋‹ฌ ์ปดํฌ๋„ŒํŠธ์˜ ์ธํ„ฐํŽ˜์ด์Šค์™€ ํƒ€์ž… ์ •์˜ ๊ฒ€์ƒ‰
rg "interface|type.*GatheringDetail" "src/app/(crew)/crew/_components/gathering-detail-modal/" -A 5

# crewId ์‚ฌ์šฉ ์ปจํ…์ŠคํŠธ ํ™•์ธ
rg "crewId" "src/app/(crew)/crew/_components/gathering-detail-modal/" -B 2 -A 2

Length of output: 3064


Script:

#!/bin/bash
# GatheringDetailType ์ธํ„ฐํŽ˜์ด์Šค ์ •์˜ ๊ฒ€์ƒ‰
rg "type.*GatheringDetailType" -A 10 "src/app/(crew)/crew/_components"

# ๋ชจ๋‹ฌ ์ปดํฌ๋„ŒํŠธ์—์„œ data prop์˜ ์‚ฌ์šฉ ํ™•์ธ
rg "data: GatheringDetailType" -B 5 -A 10 "src/app/(crew)/crew/_components"

# crewId๊ฐ€ ์‹ค์ œ๋กœ ์‚ฌ์šฉ๋˜๋Š” ๋กœ์ง ๊ฒ€์ƒ‰
rg "data\.crewId" "src/app/(crew)/crew/_components"

Length of output: 3085

Comment on lines 89 to 107
<GatheringCard
crewId={crewId}
{...card}
className="w-full"
onLike={() => {
if (isLoggedIn) {
return onLike(card.id);
}
onShowLoginModal(); // ๋กœ๊ทธ์ธ์ด ์•ˆ ๋˜์–ด ์žˆ์œผ๋ฉด ๋ชจ๋‹ฌ ํ‘œ์‹œ
return Promise.resolve();
}}
onUnlike={() => {
if (isLoggedIn) {
return onUnlike(card.id);
}
onShowLoginModal(); // ๋กœ๊ทธ์ธ์ด ์•ˆ ๋˜์–ด ์žˆ์œผ๋ฉด ๋ชจ๋‹ฌ ํ‘œ์‹œ
return Promise.resolve();
}}
/>
Copy link

Choose a reason for hiding this comment

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

โš ๏ธ Potential issue

์ข‹์•„์š”/์ข‹์•„์š” ์ทจ์†Œ ํ•ธ๋“ค๋Ÿฌ์˜ ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

ํ˜„์žฌ ๊ตฌํ˜„์—์„œ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋ฌธ์ œ์ ๋“ค์ด ๋ฐœ๊ฒฌ๋˜์—ˆ์Šต๋‹ˆ๋‹ค:

  1. ์ข‹์•„์š”์™€ ์ข‹์•„์š” ์ทจ์†Œ ํ•ธ๋“ค๋Ÿฌ์— ์ค‘๋ณต ์ฝ”๋“œ๊ฐ€ ์กด์žฌํ•ฉ๋‹ˆ๋‹ค.
  2. ๋กœ๊ทธ์ธํ•˜์ง€ ์•Š์€ ์ƒํƒœ์—์„œ Promise.resolve()๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” ๊ฒƒ์€ ์ƒ์œ„ ์ปดํฌ๋„ŒํŠธ์—์„œ ์˜ˆ์ƒ์น˜ ๋ชปํ•œ ๋™์ž‘์„ ์ผ์œผํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  3. ์—๋Ÿฌ ์ฒ˜๋ฆฌ๊ฐ€ ๋ˆ„๋ฝ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฐœ์„ ๋œ ๊ตฌํ˜„์„ ์ œ์•ˆํ•ฉ๋‹ˆ๋‹ค:

+const createAuthenticatedHandler = (
+  action: (id: number) => Promise<void>,
+  gatheringId: number,
+  showLoginModal: () => void,
+) => async () => {
+  if (!isLoggedIn) {
+    showLoginModal();
+    return;
+  }
+  
+  try {
+    await action(gatheringId);
+  } catch (error) {
+    console.error('Failed to process action:', error);
+    // ์—๋Ÿฌ ์ฒ˜๋ฆฌ ๋กœ์ง ์ถ”๊ฐ€ ํ•„์š”
+  }
+};

 <GatheringCard
   crewId={crewId}
   {...card}
   className="w-full"
-  onLike={() => {
-    if (isLoggedIn) {
-      return onLike(card.id);
-    }
-    onShowLoginModal();
-    return Promise.resolve();
-  }}
-  onUnlike={() => {
-    if (isLoggedIn) {
-      return onUnlike(card.id);
-    }
-    onShowLoginModal();
-    return Promise.resolve();
-  }}
+  onLike={createAuthenticatedHandler(onLike, card.id, onShowLoginModal)}
+  onUnlike={createAuthenticatedHandler(onUnlike, card.id, onShowLoginModal)}
 />
๐Ÿ“ 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
<GatheringCard
crewId={crewId}
{...card}
className="w-full"
onLike={() => {
if (isLoggedIn) {
return onLike(card.id);
}
onShowLoginModal(); // ๋กœ๊ทธ์ธ์ด ์•ˆ ๋˜์–ด ์žˆ์œผ๋ฉด ๋ชจ๋‹ฌ ํ‘œ์‹œ
return Promise.resolve();
}}
onUnlike={() => {
if (isLoggedIn) {
return onUnlike(card.id);
}
onShowLoginModal(); // ๋กœ๊ทธ์ธ์ด ์•ˆ ๋˜์–ด ์žˆ์œผ๋ฉด ๋ชจ๋‹ฌ ํ‘œ์‹œ
return Promise.resolve();
}}
/>
<GatheringCard
crewId={crewId}
{...card}
className="w-full"
onLike={createAuthenticatedHandler(onLike, card.id, onShowLoginModal)}
onUnlike={createAuthenticatedHandler(onUnlike, card.id, onShowLoginModal)}
/>

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.

์ข‹์•„์š” ๊ธฐ๋Šฅ์ด ๋˜๋‹ค๋‹ˆ!! ์ˆ˜๊ณ ํ•˜์…จ์Šต๋‹ˆ๋‹ค-!!

@CodeitFESI4-Team1 CodeitFESI4-Team1 deleted a comment from coderabbitai bot Nov 15, 2024
@CodeitFESI4-Team1 CodeitFESI4-Team1 deleted a comment from coderabbitai bot Nov 15, 2024
@CodeitFESI4-Team1 CodeitFESI4-Team1 deleted a comment from coderabbitai bot Nov 15, 2024
@CodeitFESI4-Team1 CodeitFESI4-Team1 deleted a comment from coderabbitai bot Nov 15, 2024
@CodeitFESI4-Team1 CodeitFESI4-Team1 deleted a comment from coderabbitai bot Nov 15, 2024
@CodeitFESI4-Team1 CodeitFESI4-Team1 deleted a comment from coderabbitai bot Nov 15, 2024
@CodeitFESI4-Team1 CodeitFESI4-Team1 deleted a comment from coderabbitai bot Nov 15, 2024
@CodeitFESI4-Team1 CodeitFESI4-Team1 deleted a comment from coderabbitai bot Nov 15, 2024
@CodeitFESI4-Team1 CodeitFESI4-Team1 deleted a comment from coderabbitai bot Nov 15, 2024
@CodeitFESI4-Team1 CodeitFESI4-Team1 deleted a comment from coderabbitai bot Nov 15, 2024
@CodeitFESI4-Team1 CodeitFESI4-Team1 deleted a comment from coderabbitai bot Nov 15, 2024
@CodeitFESI4-Team1 CodeitFESI4-Team1 deleted a comment from coderabbitai bot Nov 15, 2024
@CodeitFESI4-Team1 CodeitFESI4-Team1 deleted a comment from coderabbitai bot Nov 15, 2024
@CodeitFESI4-Team1 CodeitFESI4-Team1 deleted a comment from coderabbitai bot Nov 15, 2024
@CodeitFESI4-Team1 CodeitFESI4-Team1 deleted a comment from coderabbitai bot Nov 15, 2024
@CodeitFESI4-Team1 CodeitFESI4-Team1 deleted a comment from coderabbitai bot Nov 15, 2024
@CodeitFESI4-Team1 CodeitFESI4-Team1 deleted a comment from coderabbitai bot Nov 15, 2024
@CodeitFESI4-Team1 CodeitFESI4-Team1 deleted a comment from coderabbitai bot Nov 15, 2024
@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: 1

๐Ÿงน Outside diff range and nitpick comments (6)
src/app/(crew)/crew/detail/[id]/_components/gathering-list-section.tsx (3)

41-44: window.location ๋Œ€์‹  Next.js์˜ ๊ธฐ๋Šฅ์„ ํ™œ์šฉํ•ด์ฃผ์„ธ์š”

ํ˜„์žฌ ๊ตฌํ˜„์€ ํด๋ผ์ด์–ธํŠธ ์‚ฌ์ด๋“œ API๋ฅผ ์ง์ ‘ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. Next.js์˜ ๊ธฐ๋Šฅ์„ ํ™œ์šฉํ•˜์—ฌ ๋” ๊น”๋”ํ•˜๊ฒŒ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ˆ˜์ •์„ ์ œ์•ˆํ•ฉ๋‹ˆ๋‹ค:

  const handleLoginRedirect = () => {
-   const currentPath = window.location.href;
+   const currentPath = window.location.pathname + window.location.search;
    router.push(`/login?redirect=${encodeURIComponent(currentPath)}`);
  };

21-44: ์ด๋ฒคํŠธ ํ•ธ๋“ค๋Ÿฌ ์ตœ์ ํ™”๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค

์ด๋ฒคํŠธ ํ•ธ๋“ค๋Ÿฌ๋“ค์ด ๋งค ๋ Œ๋”๋ง๋งˆ๋‹ค ์žฌ์ƒ์„ฑ๋˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. useCallback์„ ์‚ฌ์šฉํ•˜์—ฌ ์„ฑ๋Šฅ์„ ์ตœ์ ํ™”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ˆ˜์ •์„ ์ œ์•ˆํ•ฉ๋‹ˆ๋‹ค:

const handleLike = useCallback(async (gatheringId: number) => {
  try {
    await addLike(gatheringId);
  } catch (apiError) {
    if (apiError instanceof ApiError) {
      Toast({ message: `์ฐœํ•˜๊ธฐ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค: ${apiError.message}`, type: 'error' });
    }
  }
}, []);

const handleUnlike = useCallback(async (gatheringId: number) => {
  try {
    await removeLike(gatheringId);
  } catch (apiError) {
    if (apiError instanceof ApiError) {
      Toast({ message: `์ฐœํ•˜๊ธฐ ํ•ด์ œ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค: ${apiError.message}`, type: 'error' });
    }
  }
}, []);

const handleLoginRedirect = useCallback(() => {
  const currentPath = window.location.pathname + window.location.search;
  router.push(`/login?redirect=${encodeURIComponent(currentPath)}`);
}, [router]);

53-59: GatheringCardCarousel์˜ prop ํƒ€์ž…์„ ๋ช…์‹œํ•ด์ฃผ์„ธ์š”

์ปดํฌ๋„ŒํŠธ์— ์ „๋‹ฌ๋˜๋Š” prop๋“ค์˜ ํƒ€์ž…์ด ๋ช…์‹œ๋˜์–ด ์žˆ์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ํƒ€์ž… ์•ˆ์ •์„ฑ์„ ์œ„ํ•ด prop ํƒ€์ž…์„ ์ •์˜ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

GatheringCardCarousel ์ปดํฌ๋„ŒํŠธ์— ๋‹ค์Œ๊ณผ ๊ฐ™์ด prop ํƒ€์ž…์„ ์ •์˜ํ•ด์ฃผ์„ธ์š”:

interface GatheringCardCarouselProps {
  gatheringData: GatheringData[];
  crewId: number;
  onLike: (gatheringId: number) => Promise<void>;
  onUnlike: (gatheringId: number) => Promise<void>;
  onShowLoginModal: () => void;
}
src/components/gathering-list/gathering-card-carousel.tsx (3)

11-16: ์ธํ„ฐํŽ˜์ด์Šค ๋ฌธ์„œํ™” ๊ฐœ์„  ํ•„์š”

๊ฐ ํ”„๋กœํผํ‹ฐ์˜ ๋ชฉ์ ๊ณผ ์‚ฌ์šฉ๋ฒ•์„ ๋ช…ํ™•ํžˆ ํ•˜๊ธฐ ์œ„ํ•ด JSDoc ๋ฌธ์„œํ™”๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์ด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋ฌธ์„œํ™”๋ฅผ ์ถ”๊ฐ€ํ•ด๋ณด์„ธ์š”:

 interface GatheringCardCarouselProps {
   gatheringData: GatheringType[];
   crewId: number;
+  /** ๋ชจ์ž„ ์ข‹์•„์š” ์ฒ˜๋ฆฌ ํ•จ์ˆ˜ */
   onLike: (gatheringId: number) => Promise<void>;
+  /** ๋ชจ์ž„ ์ข‹์•„์š” ์ทจ์†Œ ์ฒ˜๋ฆฌ ํ•จ์ˆ˜ */
   onUnlike: (gatheringId: number) => Promise<void>;
+  /** ๋กœ๊ทธ์ธ ๋ชจ๋‹ฌ์„ ํ‘œ์‹œํ•˜๋Š” ํ•จ์ˆ˜ */
   onShowLoginModal: () => void;
 }

30-32: ๋กœ๊ทธ์ธ ์ƒํƒœ ํ™•์ธ ๋กœ์ง ๊ฐœ์„  ์ œ์•ˆ

ํ˜„์žฌ ๊ตฌํ˜„์€ ์ •ํ™•ํ•˜์ง€๋งŒ, ๋” ๋ช…์‹œ์ ์œผ๋กœ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ฐœ์„ ํ•ด๋ณด์„ธ์š”:

- // ๋กœ๊ทธ์ธ ์—ฌ๋ถ€ ํ™•์ธ
- const token = useAuthStore((state) => state.token);
- const isLoggedIn = !!token;
+ const token = useAuthStore((state) => state.token);
+ const isLoggedIn = Boolean(token);

97-103: GatheringCard ์ปดํฌ๋„ŒํŠธ props ์ „๋‹ฌ ๋ฐฉ์‹ ๊ฐœ์„ 

ํ˜„์žฌ ๊ตฌํ˜„์€ ์ •ํ™•ํ•˜์ง€๋งŒ, ๋” ๊ฐ„๊ฒฐํ•˜๊ฒŒ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ฐœ์„ ํ•ด๋ณด์„ธ์š”:

 <GatheringCard
   crewId={crewId}
   {...card}
   className="w-full"
-  onLike={() => handleLikeAction('like', card.id)}
-  onUnlike={() => handleLikeAction('unlike', card.id)}
+  onLike={handleLikeAction.bind(null, 'like', card.id)}
+  onUnlike={handleLikeAction.bind(null, 'unlike', card.id)}
 />

์ด๋ ‡๊ฒŒ ํ•˜๋ฉด:

  1. ๋ถˆํ•„์š”ํ•œ ํ™”์‚ดํ‘œ ํ•จ์ˆ˜ ์ƒ์„ฑ์„ ๋ฐฉ์ง€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค
  2. ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ๋Ÿ‰์ด ๊ฐœ์„ ๋ฉ๋‹ˆ๋‹ค
  3. ์ปดํฌ๋„ŒํŠธ ๋ฆฌ๋ Œ๋”๋ง ์„ฑ๋Šฅ์ด ํ–ฅ์ƒ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค
๐Ÿ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 84a8539 and 9e1b752.

๐Ÿ“’ Files selected for processing (3)
  • src/app/(crew)/crew/detail/[id]/_components/gathering-list-section.tsx (2 hunks)
  • src/components/common/gathering-card/container.tsx (3 hunks)
  • src/components/gathering-list/gathering-card-carousel.tsx (4 hunks)
๐Ÿ”‡ Additional comments (4)
src/app/(crew)/crew/detail/[id]/_components/gathering-list-section.tsx (1)

26-26: Toast ์ปดํฌ๋„ŒํŠธ ์‚ฌ์šฉ ๋ฐฉ์‹์ด ์˜ฌ๋ฐ”๋ฅด์ง€ ์•Š์Šต๋‹ˆ๋‹ค

์ด์ „ ๋ฆฌ๋ทฐ์—์„œ ์ง€์ ๋œ Toast ์ปดํฌ๋„ŒํŠธ ์‚ฌ์šฉ ๋ฐฉ์‹ ๋ฌธ์ œ๊ฐ€ ์•„์ง ํ•ด๊ฒฐ๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. Toast๋Š” React ์ปดํฌ๋„ŒํŠธ์ด๋ฏ€๋กœ JSX ๋ฌธ๋ฒ•์œผ๋กœ ์‚ฌ์šฉ๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

Also applies to: 36-36

src/components/common/gathering-card/container.tsx (2)

15-16: Props ์ธํ„ฐํŽ˜์ด์Šค๊ฐ€ ์ž˜ ์ •์˜๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค! ๐Ÿ‘

๋น„๋™๊ธฐ ์ž‘์—…์„ ์œ„ํ•œ Promise ํƒ€์ž…๊ณผ ํ•จ๊ป˜ ์ข‹์•„์š”/์ข‹์•„์š” ์ทจ์†Œ ํ•ธ๋“ค๋Ÿฌ๊ฐ€ ๋ช…ํ™•ํ•˜๊ฒŒ ์ •์˜๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.


48-60: ์ด์ „ ๋ฆฌ๋ทฐ ์ฝ”๋ฉ˜ํŠธ๊ฐ€ ์•„์ง ํ•ด๊ฒฐ๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.

๋กœ๋”ฉ ์ƒํƒœ ๊ด€๋ฆฌ, ๋ ˆ์ด์Šค ์ปจ๋””์…˜ ๋ฐฉ์ง€, ๊ทธ๋ฆฌ๊ณ  ๋” ๋‚˜์€ ์—๋Ÿฌ ์ฒ˜๋ฆฌ์— ๋Œ€ํ•œ ์ด์ „ ๋ฆฌ๋ทฐ ์ฝ”๋ฉ˜ํŠธ์˜ ์ œ์•ˆ์‚ฌํ•ญ๋“ค์ด ์•„์ง ๋ฐ˜์˜๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.

src/components/gathering-list/gathering-card-carousel.tsx (1)

73-79: ์ด์ „ ๋ฆฌ๋ทฐ ์˜๊ฒฌ์ด ์•„์ง ๋ฐ˜์˜๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค

์ด์ „ ๋ฆฌ๋ทฐ์—์„œ ์ œ์•ˆ๋œ ๊ฐœ์„ ์‚ฌํ•ญ๋“ค์ด ์—ฌ์ „ํžˆ ์œ ํšจํ•ฉ๋‹ˆ๋‹ค:

  1. ์—๋Ÿฌ ์ฒ˜๋ฆฌ๊ฐ€ ๋ˆ„๋ฝ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค
  2. Promise.resolve() ๋ฐ˜ํ™˜์€ ์ž ์žฌ์  ๋ฌธ์ œ๋ฅผ ์•ผ๊ธฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค

Comment on lines +46 to +48
// TODO: ์ถ”ํ›„ ์—๋Ÿฌ, ๋กœ๋”ฉ ์ˆ˜์ •
if (isLoading) return <p>๋กœ๋”ฉ ์ค‘...</p>;
if (error) return <p>๋ฐ์ดํ„ฐ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ๋ฐ ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค</p>;
Copy link

Choose a reason for hiding this comment

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

๐Ÿ› ๏ธ Refactor suggestion

๋กœ๋”ฉ ๋ฐ ์—๋Ÿฌ ์ƒํƒœ ์ฒ˜๋ฆฌ๋ฅผ ๊ฐœ์„ ํ•ด์ฃผ์„ธ์š”

ํ˜„์žฌ ๊ตฌํ˜„์€ ๊ธฐ๋ณธ์ ์ธ ํ…์ŠคํŠธ๋งŒ ํ‘œ์‹œํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž ๊ฒฝํ—˜์„ ํ–ฅ์ƒ์‹œํ‚ค๊ธฐ ์œ„ํ•ด ๋” ๋‚˜์€ UI ์ปดํฌ๋„ŒํŠธ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฐœ์„ ์‚ฌํ•ญ์„ ์ œ์•ˆํ•ฉ๋‹ˆ๋‹ค:

  1. ๋กœ๋”ฉ ์ƒํƒœ: Skeleton UI ๋˜๋Š” ๋กœ๋”ฉ ์Šคํ”ผ๋„ˆ ์‚ฌ์šฉ
  2. ์—๋Ÿฌ ์ƒํƒœ: ์—๋Ÿฌ ๋ฉ”์‹œ์ง€์™€ ํ•จ๊ป˜ ์žฌ์‹œ๋„ ๋ฒ„ํŠผ ์ถ”๊ฐ€
  3. ๋ฐ์ดํ„ฐ ์—†์Œ ์ƒํƒœ: ์ ์ ˆํ•œ ์•ˆ๋‚ด ๋ฉ”์‹œ์ง€์™€ ํ•จ๊ป˜ ์‹œ๊ฐ์  ํ”ผ๋“œ๋ฐฑ ์ œ๊ณต
if (isLoading) return <LoadingSpinner />;
if (error) return (
  <ErrorState 
    message="๋ฐ์ดํ„ฐ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ๋ฐ ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค" 
    onRetry={() => refetch()} 
  />
);
if (!gatheringList || gatheringList.length === 0) return (
  <EmptyState message="์•„์ง ๋“ฑ๋ก๋œ ๋ชจ์ž„์ด ์—†์Šต๋‹ˆ๋‹ค" />
);

@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 (7)
src/app/(crew)/layout.tsx (1)

14-26: Toast ์„ค์ •์ด ์ ์ ˆํ•ด ๋ณด์ž…๋‹ˆ๋‹ค๋งŒ, ์ ‘๊ทผ์„ฑ ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค

Toast ์•Œ๋ฆผ์˜ ๊ธฐ๋ณธ ์„ค์ •์€ ์ ์ ˆํ•˜๋‚˜, ์Šคํฌ๋ฆฐ ๋ฆฌ๋” ์‚ฌ์šฉ์ž๋ฅผ ์œ„ํ•œ ์ ‘๊ทผ์„ฑ ์†์„ฑ์ด ๋ˆ„๋ฝ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ฐœ์„ ํ•ด๋ณด์„ธ์š”:

      <ToastContainer
        position="bottom-right"
        autoClose={3000}
        hideProgressBar={false}
        newestOnTop={false}
        closeOnClick
        rtl={false}
        pauseOnFocusLoss
        draggable
        pauseOnHover
        theme="light"
        transition={Bounce}
+       role="alert"
+       aria-live="polite"
      />

์ถ”๊ฐ€์ ์œผ๋กœ, ์•Œ๋ฆผ์ด ํ‘œ์‹œ๋˜๋Š” ์‹œ๊ฐ„(3์ดˆ)์ด ๊ธด ๋ฉ”์‹œ์ง€๋ฅผ ์ฝ๊ธฐ์—๋Š” ์งง์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฉ”์‹œ์ง€ ๊ธธ์ด์— ๋”ฐ๋ผ ๋™์ ์œผ๋กœ ์‹œ๊ฐ„์„ ์กฐ์ ˆํ•˜๋Š” ๊ฒƒ์„ ๊ณ ๋ คํ•ด๋ณด์„ธ์š”.

src/app/(crew)/crew/_components/gathering-detail-modal/container.tsx (3)

26-28: toast ์„ค์ •์„ ๊ฐœ์„ ํ•˜์—ฌ ์‚ฌ์šฉ์ž ๊ฒฝํ—˜์„ ํ–ฅ์ƒ์‹œํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ํ˜„์žฌ ๊ตฌํ˜„์€ ์ž‘๋™ํ•˜์ง€๋งŒ, ๋” ๋‚˜์€ ์‚ฌ์šฉ์ž ๊ฒฝํ—˜์„ ์œ„ํ•ด ์ถ”๊ฐ€ ์„ค์ •์„ ๊ณ ๋ คํ•ด๋ณด์„ธ์š”.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ฐœ์„ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

-    toast(message, { type });
+    toast(message, {
+      type,
+      position: "bottom-right",
+      autoClose: 3000,
+      hideProgressBar: false,
+      closeOnClick: true,
+      pauseOnHover: true,
+      draggable: true,
+    });

Line range hint 30-67: ์—๋Ÿฌ ๋ฉ”์‹œ์ง€๋ฅผ ๋” ๊ตฌ์ฒด์ ์œผ๋กœ ๊ฐœ์„ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ํ˜„์žฌ ์—๋Ÿฌ ์ฒ˜๋ฆฌ๋Š” ์ž˜ ๊ตฌํ˜„๋˜์–ด ์žˆ์ง€๋งŒ, ์‚ฌ์šฉ์ž์—๊ฒŒ ๋” ๋ช…ํ™•ํ•œ ์ •๋ณด๋ฅผ ์ œ๊ณตํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ์—๋Ÿฌ ๋ฉ”์‹œ์ง€๋ฅผ ๊ตฌ์ฒดํ™”ํ•˜๋Š” ๊ฒƒ์„ ์ œ์•ˆํ•ฉ๋‹ˆ๋‹ค:

-        showToast(`์ฐธ์—ฌ ์ค‘ ์—๋Ÿฌ ๋ฐœ์ƒ: ${error.message}`, 'error');
+        const errorMessage = error.status === 403
+          ? '์ฐธ์—ฌ ๊ถŒํ•œ์ด ์—†์Šต๋‹ˆ๋‹ค. ํฌ๋ฃจ ๋ฉค๋ฒ„๋งŒ ์ฐธ์—ฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.'
+          : `์ฐธ์—ฌํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค: ${error.message}`;
+        showToast(errorMessage, 'error');

Line range hint 17-17: ํ…Œ์ŠคํŠธ ๊ตฌํ˜„์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

ํ˜„์žฌ TODO ์ฃผ์„์— ๋ช…์‹œ๋œ ๋Œ€๋กœ ๋กœ๊ทธ์ธ ํ† ํฐ ๊ด€๋ จ ํ…Œ์ŠคํŠธ๊ฐ€ ๋ˆ„๋ฝ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ํ…Œ์ŠคํŠธ ๊ตฌํ˜„์„ ํ†ตํ•ด ์ปดํฌ๋„ŒํŠธ์˜ ์•ˆ์ •์„ฑ์„ ๋ณด์žฅํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ž‘์„ฑ์„ ๋„์™€๋“œ๋ฆด๊นŒ์š”? ๋‹ค์Œ๊ณผ ๊ฐ™์€ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๋ฅผ ์ œ์•ˆํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

  • ๋ชจ๋‹ฌ ์—ด๊ธฐ/๋‹ซ๊ธฐ ํ…Œ์ŠคํŠธ
  • ์•ฝ์† ์ฐธ์—ฌ/์ทจ์†Œ ๊ธฐ๋Šฅ ํ…Œ์ŠคํŠธ
  • ์—๋Ÿฌ ์ฒ˜๋ฆฌ ํ…Œ์ŠคํŠธ
  • ํ† ์ŠคํŠธ ๋ฉ”์‹œ์ง€ ํ‘œ์‹œ ํ…Œ์ŠคํŠธ
src/app/(crew)/crew/detail/[id]/_components/gathering-list-section.tsx (1)

21-39: ์ข‹์•„์š” ์ƒํƒœ ๊ด€๋ฆฌ ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค

ํ˜„์žฌ ๊ตฌํ˜„์—์„œ๋Š” API ํ˜ธ์ถœ ์ค‘์ธ ์ƒํƒœ๋ฅผ ์‚ฌ์šฉ์ž์—๊ฒŒ ํ‘œ์‹œํ•˜์ง€ ์•Š๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž ๊ฒฝํ—˜ ํ–ฅ์ƒ์„ ์œ„ํ•ด ๋กœ๋”ฉ ์ƒํƒœ ๊ด€๋ฆฌ๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฐœ์„ ์„ ์ œ์•ˆํ•ฉ๋‹ˆ๋‹ค:

+ const [isLikeLoading, setIsLikeLoading] = useState<number | null>(null);

  const handleLike = async (gatheringId: number) => {
+   setIsLikeLoading(gatheringId);
    try {
      await addLike(gatheringId);
    } catch (apiError) {
      if (apiError instanceof ApiError) {
        toast.error(`์ฐœํ•˜๊ธฐ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค: ${apiError.message}`);
      }
+   } finally {
+     setIsLikeLoading(null);
    }
  };

์ด ๋กœ๋”ฉ ์ƒํƒœ๋ฅผ GatheringCardCarousel์— ์ „๋‹ฌํ•˜์—ฌ ์ข‹์•„์š” ๋ฒ„ํŠผ์˜ ๋กœ๋”ฉ ์ƒํƒœ๋ฅผ ํ‘œ์‹œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

src/components/common/gathering-card/container.tsx (2)

72-78: ์—๋Ÿฌ ๋ฉ”์‹œ์ง€์˜ ๊ตญ์ œํ™”(i18n) ์ ์šฉ์„ ๊ณ ๋ คํ•ด์ฃผ์„ธ์š”.

ํ˜„์žฌ ์—๋Ÿฌ ๋ฉ”์‹œ์ง€๊ฐ€ ํ•œ๊ธ€๋กœ ํ•˜๋“œ์ฝ”๋”ฉ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ์ถ”ํ›„ ๋‹ค๊ตญ์–ด ์ง€์›์„ ์œ„ํ•ด i18n ์‹œ์Šคํ…œ์„ ๋„์ž…ํ•˜๋Š” ๊ฒƒ์ด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค.

์˜ˆ์‹œ ๊ตฌํ˜„:

- toast.error('๋ชจ์ž„ ์ •๋ณด๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.');
+ toast.error(t('errors.gathering.not_found'));

- toast.error('๋ฐ์ดํ„ฐ ํ†ต์‹ ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค.');
+ toast.error(t('errors.common.communication_failed'));

Line range hint 1-108: ์ปดํฌ๋„ŒํŠธ ๋กœ์ง ๋ถ„๋ฆฌ๋ฅผ ํ†ตํ•œ ๊ตฌ์กฐ ๊ฐœ์„ ์„ ์ œ์•ˆ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

ํ˜„์žฌ ์ปดํฌ๋„ŒํŠธ๊ฐ€ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์—ฌ๋Ÿฌ ์ฑ…์ž„์„ ๊ฐ€์ง€๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค:

  1. ์ข‹์•„์š” ์ƒํƒœ ๊ด€๋ฆฌ
  2. ๋ชจ๋‹ฌ ์ƒํƒœ ๊ด€๋ฆฌ
  3. ๋‚ ์งœ ๊ด€๋ จ ๋กœ์ง
  4. API ์—๋Ÿฌ ์ฒ˜๋ฆฌ

์ด๋ฅผ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋ถ„๋ฆฌํ•˜๋ฉด ์œ ์ง€๋ณด์ˆ˜์„ฑ์ด ํ–ฅ์ƒ๋  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค:

// hooks/useLikeToggle.ts
const useLikeToggle = (id: number, initialState: boolean) => {
  const [isLiked, setIsLiked] = useState(initialState);
  const [isLoading, setIsLoading] = useState(false);

  const toggleLike = async (onLike: Function, onUnlike: Function) => {
    // ์ข‹์•„์š” ๋กœ์ง ๊ตฌํ˜„
  };

  return { isLiked, isLoading, toggleLike };
};

// hooks/useGatheringDate.ts
const useGatheringDate = (dateTime: string) => {
  // ๋‚ ์งœ ๊ด€๋ จ ๋กœ์ง ๊ตฌํ˜„
};

// hooks/useGatheringError.ts
const useGatheringError = (error: Error | null) => {
  // ์—๋Ÿฌ ์ฒ˜๋ฆฌ ๋กœ์ง ๊ตฌํ˜„
};
๐Ÿ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 9e1b752 and 4317a4c.

๐Ÿ“’ Files selected for processing (5)
  • src/app/(crew)/crew/_components/gathering-detail-modal/container.tsx (2 hunks)
  • src/app/(crew)/crew/detail/[id]/_components/gathering-list-section.tsx (2 hunks)
  • src/app/(crew)/layout.tsx (2 hunks)
  • src/components/common/gathering-card/container.tsx (4 hunks)
  • src/components/gathering-list/liked-list-container.tsx (1 hunks)
๐Ÿšง Files skipped from review as they are similar to previous changes (1)
  • src/components/gathering-list/liked-list-container.tsx
๐Ÿ”‡ Additional comments (6)
src/app/(crew)/crew/_components/gathering-detail-modal/container.tsx (1)

3-3: react-toastify ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ import๊ฐ€ ์ ์ ˆํžˆ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

์ฝ”๋“œ๋ฒ ์ด์Šค์˜ ์ผ๊ด€์„ฑ์„ ์œ„ํ•ด toast ์•Œ๋ฆผ ์‹œ์Šคํ…œ์ด ์ž˜ ํ†ตํ•ฉ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

src/app/(crew)/crew/detail/[id]/_components/gathering-list-section.tsx (3)

4-4: Toast ๊ตฌํ˜„ ๋ฐฉ์‹ ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค

ํ˜„์žฌ toast.error()๋ฅผ ์ง์ ‘ ํ˜ธ์ถœํ•˜๋Š” ๋ฐฉ์‹์€ ์ด์ „ ๋ฆฌ๋ทฐ์—์„œ ์ง€์ ๋œ ๋ฌธ์ œ์™€ ์œ ์‚ฌํ•ฉ๋‹ˆ๋‹ค. Toast ์ปดํฌ๋„ŒํŠธ๋ฅผ React ์ปดํฌ๋„ŒํŠธ๋กœ ์ ์ ˆํ•˜๊ฒŒ ์‚ฌ์šฉํ•˜๋„๋ก ์ˆ˜์ •์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ˆ˜์ •์„ ์ œ์•ˆํ•ฉ๋‹ˆ๋‹ค:

- toast.error(`์ฐœํ•˜๊ธฐ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค: ${apiError.message}`);
+ {apiError instanceof ApiError && (
+   <Toast message={`์ฐœํ•˜๊ธฐ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค: ${apiError.message}`} type="error" />
+ )}

Also applies to: 25-27, 35-37


46-48: ๋กœ๋”ฉ ๋ฐ ์—๋Ÿฌ ์ƒํƒœ UI ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค

์ด์ „ ๋ฆฌ๋ทฐ์—์„œ ์ง€์ ๋œ ๋Œ€๋กœ, ํ˜„์žฌ ๊ตฌํ˜„์€ ๊ธฐ๋ณธ์ ์ธ ํ…์ŠคํŠธ๋งŒ ํ‘œ์‹œํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž ๊ฒฝํ—˜ ํ–ฅ์ƒ์„ ์œ„ํ•ด ๋” ๋‚˜์€ UI ์ปดํฌ๋„ŒํŠธ ์‚ฌ์šฉ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.


53-59: Props ํƒ€์ž… ๊ฒ€์ฆ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค

GatheringCardCarousel ์ปดํฌ๋„ŒํŠธ์— ์ „๋‹ฌ๋˜๋Š” props์˜ ํƒ€์ž… ์•ˆ์ „์„ฑ์„ ํ™•์ธํ•ด์ฃผ์„ธ์š”. ํŠนํžˆ ์ƒˆ๋กœ ์ถ”๊ฐ€๋œ onLike, onUnlike, onShowLoginModal props์˜ ํƒ€์ž…์ด ์ปดํฌ๋„ŒํŠธ์˜ ์ธํ„ฐํŽ˜์ด์Šค์™€ ์ผ์น˜ํ•˜๋Š”์ง€ ํ™•์ธ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

โœ… Verification successful

Props ํƒ€์ž…์ด ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ •์˜๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค

GatheringCardCarousel ์ปดํฌ๋„ŒํŠธ์˜ props ํƒ€์ž…์ด ์ธํ„ฐํŽ˜์ด์Šค์— ๋ช…ํ™•ํ•˜๊ฒŒ ์ •์˜๋˜์–ด ์žˆ์œผ๋ฉฐ, ์ „๋‹ฌ๋˜๋Š” ๋ชจ๋“  props(onLike, onUnlike, onShowLoginModal)๊ฐ€ ํƒ€์ž… ์ •์˜์™€ ์ผ์น˜ํ•ฉ๋‹ˆ๋‹ค:

  • onLike: (gatheringId: number) => Promise<void>
  • onUnlike: (gatheringId: number) => Promise<void>
  • onShowLoginModal: () => void
๐Ÿ Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# GatheringCardCarousel ์ปดํฌ๋„ŒํŠธ์˜ props ํƒ€์ž… ์ •์˜ ํ™•์ธ
ast-grep --pattern 'interface $_ {
  $$$
  onLike?: $_
  onUnlike?: $_
  onShowLoginModal?: $_
  $$$
}'

Length of output: 105


Script:

#!/bin/bash
# Search for GatheringCardCarousel component definition and its props
ast-grep --pattern 'type GatheringCardCarouselProps = {
  $$$
}'

# Also try interface pattern
ast-grep --pattern 'interface GatheringCardCarouselProps {
  $$$
}'

# Search for the component definition
ast-grep --pattern 'const GatheringCardCarousel = ({ $$ }: $_) => {
  $$$
}'

# Find the file containing GatheringCardCarousel
fd GatheringCardCarousel

Length of output: 896

src/components/common/gathering-card/container.tsx (2)

15-16: ์ธํ„ฐํŽ˜์ด์Šค ์ •์˜๊ฐ€ ๋ช…ํ™•ํ•˜๊ณ  ์ ์ ˆํ•ฉ๋‹ˆ๋‹ค.

Promise๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” ๋น„๋™๊ธฐ ํ•จ์ˆ˜๋กœ ํƒ€์ž…์ด ์ž˜ ์ •์˜๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.


48-60: ์ด์ „ ๋ฆฌ๋ทฐ ์˜๊ฒฌ์„ ๋ฐ˜์˜ํ•œ ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

์ด์ „ ๋ฆฌ๋ทฐ์—์„œ ์ œ์•ˆ๋œ ๋กœ๋”ฉ ์ƒํƒœ ๊ด€๋ฆฌ์™€ ์—๋Ÿฌ ์ฒ˜๋ฆฌ ๊ฐœ์„ ์ด ์•„์ง ๋ฐ˜์˜๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. ํ•ด๋‹น ๊ฐœ์„ ์‚ฌํ•ญ๋“ค์„ ์ ์šฉํ•˜์‹œ๋ฉด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค.

@@ -1,3 +1,4 @@
import { Bounce, ToastContainer } from 'react-toastify';
Copy link

Choose a reason for hiding this comment

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

โš ๏ธ Potential issue

์Šคํƒ€์ผ import ์ˆœ์„œ ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค

react-toastify์˜ ์Šคํƒ€์ผ ํŒŒ์ผ์ด import๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. Toast ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์Šคํƒ€์ผ๋ง๋˜๋ ค๋ฉด CSS import๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ˆ˜์ •ํ•ด์ฃผ์„ธ์š”:

import { Bounce, ToastContainer } from 'react-toastify';
+import 'react-toastify/dist/ReactToastify.css';
import '@mantine/core/styles.css';
๐Ÿ“ 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
import { Bounce, ToastContainer } from 'react-toastify';
import { Bounce, ToastContainer } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';

Comment on lines 41 to 44
const handleLoginRedirect = () => {
const currentPath = window.location.href;
router.push(`/login?redirect=${encodeURIComponent(currentPath)}`);
};
Copy link

Choose a reason for hiding this comment

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

โš ๏ธ Potential issue

URL ์ธ์ฝ”๋”ฉ ๋ณด์•ˆ ๊ฐ•ํ™”๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค

ํ˜„์žฌ ๊ตฌํ˜„์—์„œ๋Š” window.location.href๋ฅผ ์ง์ ‘ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์–ด ์ž ์žฌ์ ์ธ ๋ณด์•ˆ ์œ„ํ—˜์ด ์žˆ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. URL ํŒŒ๋ผ๋ฏธํ„ฐ์˜ ์ ์ ˆํ•œ ๊ฒ€์ฆ๊ณผ ์ •์ œ๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฐœ์„ ์„ ์ œ์•ˆํ•ฉ๋‹ˆ๋‹ค:

  const handleLoginRedirect = () => {
-   const currentPath = window.location.href;
+   const currentPath = window.location.pathname + window.location.search;
+   const sanitizedPath = currentPath.replace(/[^\w\-\.\~\/\?\[\]\@\!\$\&\'\(\)\*\+\,\;\=]/g, '');
-   router.push(`/login?redirect=${encodeURIComponent(currentPath)}`);
+   router.push(`/login?redirect=${encodeURIComponent(sanitizedPath)}`);
  };
๐Ÿ“ 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
const handleLoginRedirect = () => {
const currentPath = window.location.href;
router.push(`/login?redirect=${encodeURIComponent(currentPath)}`);
};
const handleLoginRedirect = () => {
const currentPath = window.location.pathname + window.location.search;
const sanitizedPath = currentPath.replace(/[^\w\-\.\~\/\?\[\]\@\!\$\&\'\(\)\*\+\,\;\=]/g, '');
router.push(`/login?redirect=${encodeURIComponent(sanitizedPath)}`);
};

@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: 1

๐Ÿงน Outside diff range and nitpick comments (2)
src/app/(crew)/crew/detail/[id]/_components/gathering-list-section.tsx (2)

53-59: Props ํƒ€์ž… ์ •์˜ ํ•„์š”

GatheringCardCarousel ์ปดํฌ๋„ŒํŠธ์— ์ „๋‹ฌ๋˜๋Š” props์˜ ํƒ€์ž…์ด ๋ช…์‹œ์ ์œผ๋กœ ์ •์˜๋˜์–ด ์žˆ์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ํƒ€์ž…์„ ์ •์˜ํ•˜๋Š” ๊ฒƒ์„ ์ œ์•ˆ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

interface GatheringCardCarouselProps {
  gatheringData: GatheringData[];
  crewId: number;
  onLike: (gatheringId: number) => Promise<void>;
  onUnlike: (gatheringId: number) => Promise<void>;
  onShowLoginModal: () => void;
}

60-68: ๋ชจ๋‹ฌ ์ƒํƒœ ๊ด€๋ฆฌ ๊ฐœ์„  ํ•„์š”

๋ชจ๋‹ฌ์˜ opened prop์ด showLoginModal state์™€ ์ค‘๋ณต๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ฐœ์„ ํ•˜๋Š” ๊ฒƒ์„ ์ œ์•ˆ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

  {showLoginModal && (
    <ConfirmModal
-     opened={showLoginModal}
      onClose={() => setShowLoginModal(false)}
      onConfirm={handleLoginRedirect}
    >
      ๋กœ๊ทธ์ธ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค!
    </ConfirmModal>
  )}
๐Ÿ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 4317a4c and e82ff4c.

๐Ÿ“’ Files selected for processing (2)
  • src/app/(crew)/crew/detail/[id]/_components/gathering-list-section.tsx (2 hunks)
  • src/app/(crew)/layout.tsx (2 hunks)
๐Ÿšง Files skipped from review as they are similar to previous changes (1)
  • src/app/(crew)/layout.tsx
๐Ÿ”‡ Additional comments (3)
src/app/(crew)/crew/detail/[id]/_components/gathering-list-section.tsx (3)

4-4: toast ์ปดํฌ๋„ŒํŠธ ์‚ฌ์šฉ ๋ฐฉ์‹ ๊ฐœ์„  ํ•„์š”

์ด์ „ ๋ฆฌ๋ทฐ ์ฝ”๋ฉ˜ํŠธ์—์„œ ์ง€์ ๋œ ๊ฒƒ์ฒ˜๋Ÿผ, toast ์ปดํฌ๋„ŒํŠธ๊ฐ€ ํ•จ์ˆ˜ํ˜•ํƒœ๋กœ ํ˜ธ์ถœ๋˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. React ์ปดํฌ๋„ŒํŠธ๋กœ ์ ์ ˆํžˆ ๋ Œ๋”๋ง๋˜๋„๋ก ์ˆ˜์ •์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.


41-44: ๋กœ๊ทธ์ธ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ ๋กœ์ง ๋ณด์•ˆ ๊ฐ•ํ™” ํ•„์š”

ํ˜„์žฌ ๊ตฌํ˜„์—์„œ URL ํŒŒ๋ผ๋ฏธํ„ฐ์— ๋Œ€ํ•œ ์ ์ ˆํ•œ ๊ฒ€์ฆ์ด ๋ˆ„๋ฝ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.


46-48: ๋กœ๋”ฉ ๋ฐ ์—๋Ÿฌ ์ƒํƒœ UI ๊ฐœ์„  ํ•„์š”

ํ˜„์žฌ ๋‹จ์ˆœ ํ…์ŠคํŠธ๋กœ ํ‘œ์‹œ๋˜๋Š” ๋กœ๋”ฉ ๋ฐ ์—๋Ÿฌ ์ƒํƒœ๋ฅผ ์‚ฌ์šฉ์ž ๊ฒฝํ—˜์„ ๊ณ ๋ คํ•œ UI ์ปดํฌ๋„ŒํŠธ๋กœ ๊ฐœ์„ ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

Comment on lines +21 to +29
const handleLike = async (gatheringId: number) => {
try {
await addLike(gatheringId);
} catch (apiError) {
if (apiError instanceof ApiError) {
toast.error(`์ฐœํ•˜๊ธฐ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค: ${apiError.message}`);
}
}
};
Copy link

Choose a reason for hiding this comment

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

๐Ÿ› ๏ธ Refactor suggestion

์—๋Ÿฌ ์ฒ˜๋ฆฌ ๋กœ์ง ๊ฐœ์„  ํ•„์š”

์—๋Ÿฌ ์ฒ˜๋ฆฌ ๋กœ์ง์ด handleLike์™€ handleUnlike์—์„œ ์ค‘๋ณต๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ ์ผ๋ฐ˜์ ์ธ ์—๋Ÿฌ ์ƒํ™ฉ์— ๋Œ€ํ•œ ์ฒ˜๋ฆฌ๊ฐ€ ๋ˆ„๋ฝ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ฐœ์„ ํ•˜๋Š” ๊ฒƒ์„ ์ œ์•ˆ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

+ const handleApiError = (action: string, error: unknown) => {
+   if (error instanceof ApiError) {
+     toast.error(`${action}์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค: ${error.message}`);
+   } else {
+     toast.error(`${action} ์ค‘ ์˜ˆ์ƒ์น˜ ๋ชปํ•œ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค`);
+     console.error(error);
+   }
+ };

  const handleLike = async (gatheringId: number) => {
    try {
      await addLike(gatheringId);
    } catch (error) {
-     if (apiError instanceof ApiError) {
-       toast.error(`์ฐœํ•˜๊ธฐ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค: ${apiError.message}`);
-     }
+     handleApiError('์ฐœํ•˜๊ธฐ', error);
    }
  };

  const handleUnlike = async (gatheringId: number) => {
    try {
      await removeLike(gatheringId);
    } catch (error) {
-     if (apiError instanceof ApiError) {
-       toast.error(`์ฐœํ•˜๊ธฐ ํ•ด์ œ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค: ${apiError.message}`);
-     }
+     handleApiError('์ฐœํ•˜๊ธฐ ํ•ด์ œ', error);
    }
  };

Also applies to: 31-39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

์ฐœํ•˜๊ธฐ ๊ด€๋ จ api ์—ฐ๊ฒฐ, ์ฐœํ•œ ๋ชจ์ž„๋ฆฌ์ŠคํŠธ ์ˆ˜์ •

4 participants