Skip to content

Dialog 코어 5-size recipe 재설계 + Alert/Confirm sugar 도입 - #398

Merged
sumi-0011 merged 17 commits into
devfrom
refactor/common-dialog
Jul 10, 2026
Merged

Dialog 코어 5-size recipe 재설계 + Alert/Confirm sugar 도입#398
sumi-0011 merged 17 commits into
devfrom
refactor/common-dialog

Conversation

@sumi-0011

Copy link
Copy Markdown
Member

💻 작업 내용

@gitanimals/ui-tailwind Dialog를 5-size recipe 기반으로 재작성하고, 앱 전역의 confirm/alert 다이얼로그 중복을 sugar로 통합했습니다.

핵심 변경

  • Dialog 코어 재작성 (packages/ui/tailwind/src/components/dialog/Dialog.tsx)

    • size = 'sm' | 'md' | 'lg' | 'screen' | 'hero' — 폭·패딩·gap·Title/Description 타이포·Footer 정렬을 recipe로 통합
    • DialogSizeContext 도입: Content가 size를 provide, Title/Description/Footer가 자동 consume
    • Title 기본값을 실사용 다수(glyph20 left)에 맞춤. 히어로 타이포는 size='hero' opt-in
    • screen(플레인 풀뷰포트)과 hero(축하/결과) 분리 — 폼과 celebration이 같은 사이즈로 묶이던 문제 해소
  • Alert / Confirm sugar 내장 (Dialog.Alert, Dialog.Confirm)

    • size별 Button 크기 자동 배정 (buttonSizeForDialogSize)
    • i18n 무의존 (기본값 영문 하드코딩, 소비자가 t() 넘김)
    • Dialog.Confirm은 Promise onConfirm 로딩 상태 자체 관리
  • 6개 프리미티브 → 2개 sugar + compound로 축소

    • 삭제: CommonDialog, apps/web/ConfirmDialog, quiz Fail/Complete/CorrectConfirmDialog, laboratory AlertDialog
    • useDialog() 공개 API는 유지, DialogComponent 내부만 sugar로 재작성 (호출부 무변경)
    • MergePersona(lg), EvolutionPersona(hero), OnePet/TenPet(hero) 등 사용처 재분류
  • 잔여 정리

    • size='large'size='lg', 구 size='screen' 케이스별 screen/hero 재분류
    • Title/Description/Footer의 redundant className override 제거 (recipe에 흡수)
    • MergePersona footer justify-center, RouteModal containerStyle 등 도메인 override는 유지

검증

  • pnpm --filter @gitanimals/web type-check → 0 errors
  • pnpm --filter @gitanimals/web lint → 0 errors
  • 순환 import(Dialog ↔ Alert/Confirm)는 ES module live binding으로 안전

Out of Scope (다음 PR)

  • RouteModal useState/useEffect(pathname) 재작성
  • PageModal 이름/위치 정리
  • dialogTitleStyle raw 사용처 4곳 (guild subpage + PageModal)

📸 스크린샷

시각적으로는 대부분 등가이지만 아래 3곳은 의도적 변경입니다:

  • EvolutionPersona / OnePet / TenPet / MergeResult / EvolutionResult / PetGotcha: hero 사이즈 celebration recipe 적용 (풀뷰포트 + glyph48 히어로 title + 중앙 정렬)
  • Quiz Fail/Complete/CorrectConfirm 다이얼로그: 이미지와 dismiss 차단 정책(X/ESC/외부클릭 막기) 원본 정책 복원
  • Global useDialog imperative confirm: 원본 사이즈(md, 560px)로 유지되도록 명시

sumi-0011 and others added 10 commits July 8, 2026 15:40
…으로 재작성

- DialogSizeContext 도입: Content의 size를 Title/Description/Footer가 자동 consume
- size별 폭/패딩/타이포/정렬 recipe 통합, 오버라이드 필요 없앰
- 기존 default→md, large→lg 매핑. hero(축하)와 screen(플레인 풀뷰포트) 분리
- dialogTitleStyle export는 스코프 밖 사용처 보호 위해 값 유지
- buttonSizeForDialogSize 내부 매핑 export (Alert/Confirm sugar 준비)
- size 별 recipe에 맞춰 Button size 자동 배정
- Confirm은 Promise onConfirm 로딩 상태 자동 관리
- i18n 텍스트는 소비자가 넘김 (라이브러리는 next-intl 무의존)
- CommonDialog는 곧 삭제 예정 (Task 3)
훅 시그니처는 그대로 유지 (호출부 무변경).
onConfirm 있으면 Confirm, 없으면 Alert 로 렌더.
…로 통합

FailAlertDialog, CompleteAlertDialog, CorrectConfirmDialog(퀴즈 풀이),
laboratory AlertDialog(미사용) 를 삭제하고 SolvingQuizSection 에서
Dialog.Alert / Dialog.Confirm sugar 를 직접 사용하도록 마이그레이션.

- laboratory AlertDialog 는 어떤 곳에서도 import 되지 않는 데드코드로 확인 후 삭제.
- CorrectConfirmDialog 는 challenge(계속하기)/stop(중단) 두 버튼이 서로 다른 부수효과를
  가지므로, Dialog.Confirm 의 onConfirm 성공 후 자동 onOpenChange(false) 호출과
  cancel 버튼의 onOpenChange(false) 호출을 구분하기 위해 ref 플래그로 가드.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Task 6 리뷰 회귀 수정:
- FailAlertDialog/CompleteAlertDialog/CorrectConfirmDialog 삭제 후
  Dialog.Alert/Dialog.Confirm sugar 로 이관하며 누락된 160x160 보상 이미지
  (cursor-unchoiced.webp, quiz-double-coin.webp, quiz-coin.svg) 복구
- CorrectConfirmDialog 원본의 ESC/외부클릭/X 닫기 차단(명시적 challenge/stop
  선택 강제) 정책을 Dialog.Content(isShowClose=false,
  onEscapeKeyDown/onPointerDownOutside preventDefault)로 복구
- Dialog.Confirm 내부 호출 순서에 의존하던 취약한 useRef 이중발화 가드 제거,
  challenge/stop 버튼을 각각 moveToNextStage / stopQuiz+terminateQuiz 로 직접 연결

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- OnePet/TenPet: hero (celebration 카드 뽑기)
- PersonaSearch/LinePersonaSelect/FarmPersonaSelect/RouteModal: lg
- EditModal 등 기본: md (size 생략)
- Dialog.Title/Description 의 recipe 중복 오버라이드 className 제거
size='hero' recipe는 items-center/justify-center을 포함하지 않아 카드 뽑기 컨텐츠가 상단 고정됨. 도메인 요구로 consumer에서 정렬 override 유지.
…og 기본 size md 복원

- Quiz Fail/Complete 다이얼로그: X/ESC/외부클릭 차단 (CorrectConfirm과 동일 정책)
- Global useDialog: Alert/Confirm에 size="md" 명시 (원본 다이얼로그 크기 유지)
@sumi-0011
sumi-0011 requested a review from hyesungoh as a code owner July 8, 2026 08:45
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 95a5d83b-ae71-401f-9159-f59510214f1a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/common-dialog

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.

sumi-0011 and others added 7 commits July 9, 2026 09:03
- 5-size recipe(sm/md/lg/screen/hero) 매트릭스 스토리
- Dialog.Alert / Dialog.Confirm sugar 스토리
- 도메인 override 패턴(MergePersona 스타일) 예제
- 루트 sb:tailwind 스크립트 추가

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- OverflowScrollable: scrollable + Dialog.Body 조합 권장 패턴
- OverflowUnmanaged: 미처리 시 Footer 밀림 안티패턴

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- sm/md/lg: max-w-[min(size,calc(100vw-40px))] + max-h-[calc(100vh-40px)]로 최소 20px 여백 보장
- lg 모바일 풀스크린 정책 제거 (일관된 20px 여백)
- screen/hero는 의도적 풀뷰포트로 유지
- Dialog.Body를 Radix ScrollArea 기반으로 변경 (네이티브 스크롤바 대신 커스텀)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Radix ScrollArea는 flex-1 컨테이너 안에서 Viewport의 percentage height
cascade가 깨져 스크롤이 동작하지 않음. native overflow-y-auto로 되돌리고
스크롤바만 tailwind arbitrary로 얇고 어둡게 커스텀 스타일링.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- sm/md/lg 의 max-width 를 arbitrary property 문법으로 변경: Tailwind JIT extractor 가
  중첩된 min()+calc() 를 놓쳐 CSS 미생성되던 문제 (다이얼로그 폭이 100vw 로 확장) 해결
- dialogScrollableStyle 에 h-[calc(100vh-40px)] 추가: Content 가 콘텐츠에 맞춰 축소되면
  flex-1 Body 가 0 이 되어 InventoryGrid(rows='auto') 가 렌더 안 되던 문제 수정

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
# Conflicts:
#	apps/web/src/app/[locale]/shop/_petGotcha/TenPet.tsx
@sumi-0011
sumi-0011 merged commit 9c818ff into dev Jul 10, 2026
5 checks passed
@sumi-0011
sumi-0011 deleted the refactor/common-dialog branch July 10, 2026 00:52
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.

1 participant