Skip to content

feat: 토너먼트 생성 페이지 바스켓 UX 개선#141

Merged
iOdiO89 merged 9 commits into
devfrom
style/tournament-basket-ui
Jun 9, 2026
Merged

feat: 토너먼트 생성 페이지 바스켓 UX 개선#141
iOdiO89 merged 9 commits into
devfrom
style/tournament-basket-ui

Conversation

@kanghaeun

@kanghaeun kanghaeun commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

작업 요약

  • 바스켓 만석 처리, 캐러셀 로직 훅 분리, 높이 반응형 구현 등 토너먼트 생성 페이지 바스켓 UX 전반 개선

작업 세부 내용

바스켓 최대 아이템 수 도달

  • 아이템 8개가 모두 채워지면 + 버튼 숨김 처리
  • 바스켓이 꽉 차서 새 바스켓이 생성될 때 토스트 알림 노출
    • 문구: 카트가 꽉 찼어요! 새 카트를 만들었어요.

캐러셀 로직 훅 분리

  • 기존 useBasketCarousel을 embla carousel API 기반으로 재작성
  • 캐러셀 제어 로직(스크롤, 이벤트 구독, 인디케이터 동기화)을 훅으로 분리
  • 캐러셀 슬라이드 크기 BASKET_CAROUSEL_SLIDE_SIZE_PERCENT 75% → 90% 조정

높이 반응형 구현

  • useContainerHeight 훅 추가 — ResizeObserver로 컨테이너 높이를 실시간 측정
  • 바스켓이 화면 높이를 넘지 않도록 maxHeight 제어

신규 파일 (공용 훅)

  • src/hooks/useContainerHeight.ts: 엘리먼트 높이를 ResizeObserver로 추적

Summary by CodeRabbit

  • 새로운 기능

    • 바구니가 가득 찼을 때 알림이 표시됩니다.
    • 컨테이너 높이 측정 훅이 추가되었습니다.
  • 기능 개선

    • 바구니에 슬롯이 남아있을 때만 아이템 추가 버튼과 대화상자가 표시됩니다.
    • 캐러셀 슬라이드 비율이 조정되어 레이아웃이 개선되었습니다.
    • 캐러셀 관련 로직이 정리되어 안정성과 동기화가 향상되었습니다.

@vercel

vercel Bot commented Jun 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
depromeet Ready Ready Preview, Comment Jun 9, 2026 4:27am

@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

토너먼트 아이템 바구니 캐러셀을 Embla Carousel API와 동기화하도록 훅을 재구성하고, 컨테이너 높이 측정 훅을 추가하여 동적 maxHeight 계산, 조건부 위시 아이템 다이얼로그 렌더링, 및 캐러셀 슬라이드 크기 상수 조정을 적용합니다.

Changes

바구니 캐러셀 Embla 통합 및 레이아웃 개선

Layer / File(s) Summary
컨테이너 높이 측정 훅
apps/web/src/hooks/useContainerHeight.ts
ResizeObserver로 요소의 clientHeight를 관찰하고 { ref, height }를 반환하는 클라이언트 훅을 추가합니다.
바구니 캐러셀 훅 리팩터링
apps/web/src/app/tournament/[id]/create/_hooks/useBasketCarousel.ts
훅 시그니처를 items/scrollToLast/onScrolled 파라미터 기반으로 바꾸고 carouselApi 상태, 이벤트 리스너, currentIndex, activeBasketCount, isCarouselEnabled, handleIndicatorSelect를 반환하도록 재구성합니다.
캐러셀 컴포넌트 통합
apps/web/src/app/tournament/[id]/create/_components/tournament-item-basket/TournamentItemBasketCarousel.tsx
리팩터링된 훅과 useContainerHeight를 통합해 basketMaxHeight를 계산하고 TournamentItemBasketmaxHeight를 전달합니다. 활성 바구니 증가 시 toast.info 알림을 추가하고, 인디케이터를 측정용 div로 래핑합니다.
캐러셀 슬라이드 크기 상수 조정
apps/web/src/app/tournament/[id]/create/_consts/tournamentItemBasket.ts
BASKET_CAROUSEL_SLIDE_SIZE_PERCENT 값을 75에서 90으로 변경했습니다.
바구니 아이템 조건부 렌더링
apps/web/src/app/tournament/[id]/create/_components/tournament-item-basket/TournamentItemBasket.tsx
maxHeight 타입을 `number

Sequence Diagram

sequenceDiagram
  participant CarouselComp as TournamentItemBasketCarousel
  participant HeightHook as useContainerHeight
  participant BasketHook as useBasketCarousel
  participant Embla as CarouselApi
  participant Basket as TournamentItemBasket

  CarouselComp->>BasketHook: items, scrollToLast, onScrolled 전달
  CarouselComp->>HeightHook: indicator/container ref 연결
  BasketHook->>Embla: reInit()/select 이벤트 등록
  Embla->>BasketHook: select/reInit 이벤트 전달
  BasketHook->>CarouselComp: carouselApi, currentIndex, isCarouselEnabled 반환
  CarouselComp->>Basket: maxHeight 전달하여 렌더링
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

refactor

Suggested reviewers

  • ychany
  • iOdiO89

Poem

🐰 바구니가 흔들려도 걱정 마요,
Embla가 살포시 자리를 잡아주네.
높이를 재고, 슬라이드를 다시 맞추니,
새 카트 조용히 도착했어요 — 토스트가 웃네.
토너먼트 준비, 깔끔히 정리됐어요 ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 변경사항의 주요 목표를 정확하게 반영하고 있습니다. '토너먼트 생성 페이지 바스켓 UX 개선'은 바스켓 최대 아이템 처리, 캐러셀 로직 개선, 높이 반응형 구현 등 여러 변경사항의 공통 목표를 명확하게 요약합니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch style/tournament-basket-ui

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

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown

No description provided.

@github-actions github-actions Bot added the feature New feature or request label Jun 2, 2026
@github-actions
github-actions Bot requested review from iOdiO89 and ychany June 2, 2026 18:46

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/web/src/app/tournament/`[id]/create/_hooks/useBasketCarousel.ts:
- Around line 23-39: The effect in useBasketCarousel currently ignores the
scrollToLast flag after mount and always auto-scrolls when items.length
increases; update the useEffect to include scrollToLast in its dependency logic
and branch so that when scrollToLast is false you only update
prevItemCountRef.current = items.length (no scroll), and only call
carouselApi.scrollTo(getBasketIndexForLastItem(items.length)) and onScrolled
when scrollToLast is true (and carouselApi/isCarouselEnabled conditions still
apply). Ensure you reference prevItemCountRef, scrollToLast, carouselApi,
getBasketIndexForLastItem, onScrolled, isCarouselEnabled, and items.length when
making the change.

In `@apps/web/src/hooks/useContainerHeight.ts`:
- Around line 9-16: The useEffect in useContainerHeight currently only runs once
and observes the initial ref.current, so when the same ref is re-attached to a
different DOM node (as happens with containerRef/indicatorRef in
TournamentItemBasketCarousel) the ResizeObserver isn't updated; modify
useContainerHeight to accept or manage the actual DOM element (e.g., switch to a
callback ref or expose a setElement state) and register the ResizeObserver
inside an effect that depends on that element, ensuring you call
observer.observe(element) and disconnect the previous observer whenever the
element changes; update references to useContainerHeight, ref, setHeight and
ResizeObserver accordingly so reattachments re-register observation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 84f3381e-87b2-43fe-aaa6-7542560096ae

📥 Commits

Reviewing files that changed from the base of the PR and between 665f0e1 and fb2f8ba.

⛔ Files ignored due to path filters (1)
  • apps/web/src/app/tournament/[id]/create/_assets/basket-gray.png is excluded by !**/*.png
📒 Files selected for processing (5)
  • apps/web/src/app/tournament/[id]/create/_components/tournament-item-basket/TournamentItemBasket.tsx
  • apps/web/src/app/tournament/[id]/create/_components/tournament-item-basket/TournamentItemBasketCarousel.tsx
  • apps/web/src/app/tournament/[id]/create/_consts/tournamentItemBasket.ts
  • apps/web/src/app/tournament/[id]/create/_hooks/useBasketCarousel.ts
  • apps/web/src/hooks/useContainerHeight.ts

Comment thread apps/web/src/app/tournament/[id]/create/_hooks/useBasketCarousel.ts Outdated
Comment thread apps/web/src/hooks/useContainerHeight.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
apps/web/src/app/tournament/[id]/create/_hooks/useBasketCarousel.ts (1)

8-8: ⚡ Quick win

상대 경로 대신 절대 경로를 사용하세요.

코딩 가이드라인에 따라 @/* 절대 경로 별칭을 사용해야 합니다. 동일 파일 내 다른 import(lines 5-6)와 일관성도 맞출 수 있습니다.

♻️ 수정 제안
-import { getActiveBasketCount, getBasketIndexForLastItem } from '../_utils/tournamentItemBasket';
+import { getActiveBasketCount, getBasketIndexForLastItem } from '`@/app/tournament/`[id]/create/_utils/tournamentItemBasket';
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/src/app/tournament/`[id]/create/_hooks/useBasketCarousel.ts at line
8, Replace the relative import of utility functions with the project’s absolute
alias: change the import that currently brings in getActiveBasketCount and
getBasketIndexForLastItem from '../_utils/tournamentItemBasket' to use the
'`@/`...' alias so it matches the other imports in this file; locate the import
line that references getActiveBasketCount and getBasketIndexForLastItem and
update the path to the corresponding absolute path under the `@/src` (or project
src root) alias used by other imports in this module.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@apps/web/src/app/tournament/`[id]/create/_hooks/useBasketCarousel.ts:
- Line 8: Replace the relative import of utility functions with the project’s
absolute alias: change the import that currently brings in getActiveBasketCount
and getBasketIndexForLastItem from '../_utils/tournamentItemBasket' to use the
'`@/`...' alias so it matches the other imports in this file; locate the import
line that references getActiveBasketCount and getBasketIndexForLastItem and
update the path to the corresponding absolute path under the `@/src` (or project
src root) alias used by other imports in this module.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 62cfdfce-d7a5-44dd-b9dd-de2e5de0373d

📥 Commits

Reviewing files that changed from the base of the PR and between fb2f8ba and 4e7d49d.

📒 Files selected for processing (4)
  • apps/web/src/app/tournament/[id]/create/_components/tournament-item-basket/TournamentItemBasket.tsx
  • apps/web/src/app/tournament/[id]/create/_components/tournament-item-basket/TournamentItemBasketCarousel.tsx
  • apps/web/src/app/tournament/[id]/create/_hooks/useBasketCarousel.ts
  • apps/web/src/hooks/useContainerHeight.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/web/src/app/tournament/[id]/create/_components/tournament-item-basket/TournamentItemBasket.tsx
  • apps/web/src/hooks/useContainerHeight.ts
  • apps/web/src/app/tournament/[id]/create/_components/tournament-item-basket/TournamentItemBasketCarousel.tsx

@iOdiO89
iOdiO89 merged commit cc2a776 into dev Jun 9, 2026
6 checks passed
@iOdiO89
iOdiO89 deleted the style/tournament-basket-ui branch June 9, 2026 04:36
iOdiO89 added a commit that referenced this pull request Jun 10, 2026
* feat: 장바구니 아이템 수에 따라 위시 아이템 추가 버튼 표시 조건 변경

* feat: 장바구니 아이템 수 증가 시 toast 알림 추가

* refactor: 바스켓 캐러셀 로직 훅으로 분리

* refactor: 바스켓 캐러셀 슬라이드 크기 조정

* feat: 장바구니 컨테이너 높이 반응형 구현

* refactor: TournamentItemBasket 컴포넌트 maxHeight 타입 수정 및 TournamentItemBasketCarousel에서 높이 계산 로직 개선

* fix: ResizeObserver ref 재부착 시 observer 재등록 처리

* fix: crollToLast 조건 누락 수정

---------

Co-authored-by: Jung Sun A <amber0809@naver.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants