Skip to content

refactor: 전화번호 입력 시 자동 하이픈 생성#167

Merged
xaexunxang merged 4 commits intodevelopfrom
refact/#165/number-hyphen
Jun 7, 2025
Merged

refactor: 전화번호 입력 시 자동 하이픈 생성#167
xaexunxang merged 4 commits intodevelopfrom
refact/#165/number-hyphen

Conversation

@xaexunxang
Copy link
Copy Markdown
Contributor

@xaexunxang xaexunxang commented Jun 6, 2025

회원가입

image

대시보드 (이벤트 기본정보)

image

호스트 생성 (주최자 정보 입력)

image

Summary by CodeRabbit

  • 신규 기능

    • 전화번호 입력 시 자동으로 하이픈(-)이 포함된 한국 휴대폰 번호 형식으로 포맷팅되는 기능이 추가되었습니다.
  • 버그 수정

    • 전화번호 입력란의 안내 문구와 라벨이 실제 입력 형식과 일치하도록 개선되었습니다.
  • 스타일

    • 전화번호 입력 필드의 플레이스홀더 및 라벨 문구가 더 명확하게 변경되었습니다.
  • 문서화

    • 전화번호 형식 안내 메시지가 구체적인 예시("010-1234-5678")로 수정되었습니다.

@xaexunxang xaexunxang requested review from Yejiin21 and hyeeuncho June 6, 2025 16:19
@xaexunxang xaexunxang self-assigned this Jun 6, 2025
@xaexunxang xaexunxang linked an issue Jun 6, 2025 that may be closed by this pull request
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jun 6, 2025

Walkthrough

전화번호 입력 필드에 대해 하이픈이 포함된 한국 휴대폰 번호 형식(예: 010-1234-5678)으로 자동 포맷팅하는 기능이 여러 페이지에 도입되었습니다. 입력값 저장 시에는 하이픈이 제거되어 숫자만 저장됩니다. 유효성 검사 로직도 이에 맞게 단순화되었습니다.

Changes

파일/경로 변경 요약
src/pages/dashboard/ui/EventInfoPage.tsx 전화번호 입력값을 한국 휴대폰 번호 형식으로 자동 포맷팅, 저장 시 하이픈 제거, placeholder 수정, 관련 핸들러 및 import 위치 조정
src/pages/event/ui/create-event/EventOrganizerInfoPage.tsx 전화번호 입력값을 하이픈 포함 형식으로 포맷팅, controlled input 적용, label/placeholder 수정, 포맷팅 함수 추가
src/pages/join/InfoInputPage.tsx 전화번호 입력값을 실시간으로 포맷팅, controlled input 적용, placeholder 및 문자열 스타일 변경, 포맷팅 함수 추가
src/shared/lib/formValidation.ts 전화번호 유효성 검사에서 길이 체크 제거, 정규식만으로 포맷 검증, 에러 메시지 구체화
src/shared/utils/phoneFormatter.ts 전화번호 하이픈 포함 형식으로 포맷팅하는 formatPhoneNumber 함수 추가

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant PhoneInput
    participant FormatFunc
    participant State/Form
    participant Validation

    User->>PhoneInput: 전화번호 입력
    PhoneInput->>FormatFunc: 입력값 전달
    FormatFunc->>PhoneInput: 하이픈 포함 포맷팅 적용
    PhoneInput->>State/Form: 포맷된 값 저장
    State/Form->>Validation: 저장 시 정규식으로 유효성 검사
    State/Form->>서버: 하이픈 제거 후 전송
Loading

Suggested labels

🪄 Refactoring

Suggested reviewers

  • hyeeuncho
  • Yejiin21

Poem

전화번호에 하이픈이 쏙,
토끼가 깡총, 코드를 톡!
입력할 때 자동으로 변신,
010-1234-5678, 깔끔한 신.
숫자만 저장, 실수는 뚝!
오늘도 개발은 한 걸음 쑥🐇✨


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between eb98527 and 5ba2347.

📒 Files selected for processing (4)
  • src/pages/dashboard/ui/EventInfoPage.tsx (4 hunks)
  • src/pages/event/ui/create-event/EventOrganizerInfoPage.tsx (4 hunks)
  • src/pages/join/InfoInputPage.tsx (4 hunks)
  • src/shared/utils/phoneFormatter.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/shared/utils/phoneFormatter.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/pages/dashboard/ui/EventInfoPage.tsx
  • src/pages/event/ui/create-event/EventOrganizerInfoPage.tsx
  • src/pages/join/InfoInputPage.tsx
✨ Finishing Touches
  • 📝 Generate Docstrings

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

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

Support

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

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

CodeRabbit Commands (Invoked using PR comments)

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

Other keywords and placeholders

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

CodeRabbit Configuration File (.coderabbit.yaml)

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

Documentation and Community

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

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 6, 2025

Copy link
Copy Markdown

@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

♻️ Duplicate comments (2)
src/pages/join/InfoInputPage.tsx (1)

11-16: 🛠️ Refactor suggestion

중복된 formatPhoneNumber 함수입니다.

이 함수는 다른 컴포넌트들과 동일합니다. 공통 유틸리티로 추출하여 코드 중복을 제거하세요.

src/pages/event/ui/create-event/EventOrganizerInfoPage.tsx (1)

14-19: 🛠️ Refactor suggestion

중복된 formatPhoneNumber 함수입니다.

네 번째로 동일한 함수가 중복 구현되었습니다. 반드시 공통 유틸리티로 추출하세요.

🧹 Nitpick comments (1)
src/pages/join/InfoInputPage.tsx (1)

71-71: 기존 전화번호 데이터 포맷팅을 고려하세요.

기존 사용자 데이터에 전화번호가 있다면 포맷팅하여 표시해야 할 수 있습니다. 현재는 빈 문자열로 초기화하고 있습니다.

기존 전화번호가 있다면 포맷팅하여 표시하도록 수정하세요:

-        phone: '',
+        phone: data.phoneNumber ? formatPhoneNumber(data.phoneNumber) : '',
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between df06460 and eb98527.

📒 Files selected for processing (4)
  • src/pages/dashboard/ui/EventInfoPage.tsx (4 hunks)
  • src/pages/event/ui/create-event/EventOrganizerInfoPage.tsx (3 hunks)
  • src/pages/join/InfoInputPage.tsx (4 hunks)
  • src/shared/lib/formValidation.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/pages/join/InfoInputPage.tsx (2)
src/shared/lib/formValidation.ts (1)
  • FormData (25-25)
src/features/join/api/user.ts (1)
  • updateUser (11-16)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: storybook
🔇 Additional comments (8)
src/shared/lib/formValidation.ts (1)

12-12: 유효성 검사 로직 개선이 적절합니다.

.refine() 체크를 제거하고 regex 패턴만 사용하는 것이 자동 포맷팅 기능과 잘 맞습니다. 에러 메시지도 더 명확해졌습니다.

src/pages/dashboard/ui/EventInfoPage.tsx (3)

64-64: 저장 시 하이픈 제거 로직이 올바릅니다.

API 요청 시 하이픈을 제거하여 숫자만 저장하는 것이 데이터 일관성 측면에서 적절합니다.


123-126: controlled input 구현이 올바릅니다.

placeholder 변경과 onChange 핸들러를 통한 자동 포맷팅이 잘 구현되었습니다.


85-85:

Details

❓ Verification inconclusive

기존 데이터 로딩 시 포맷팅을 확인하세요.

API에서 받아온 기존 전화번호 데이터가 하이픈 없이 저장되어 있다면, 화면에 표시할 때 포맷팅이 필요할 수 있습니다.

다음 스크립트로 API 응답 데이터 구조를 확인하세요:


🏁 Script executed:

#!/bin/bash
# API 응답에서 전화번호 필드 형식 확인
rg -A 3 -B 3 "organizerPhoneNumber\|phoneNumber" --type ts

Length of output: 60


기존 전화번호 포맷팅 확인 필요

API에서 organizerPhoneNumber를 하이픈 없이 순수 숫자만 반환할 경우, 화면에 표시될 때 하이픈(-)을 추가하는 포맷팅 로직이 필요할 수 있습니다.
src/pages/dashboard/ui/EventInfoPage.tsx 85라인의 setPhone(info.organizerPhoneNumber) 호출 이후 포맷팅 적용 여부를 확인해주세요.

  • 확인 방법: 브라우저 네트워크 탭 또는 API 클라이언트에서 organizerPhoneNumber 값 형식 검증
  • 필요 시 예시:
    const formatted = info.organizerPhoneNumber.replace(/(\d{3})(\d{4})(\d{4})/, '$1-$2-$3');
    setPhone(formatted);
src/pages/join/InfoInputPage.tsx (2)

42-45: controlled input 구현이 적절합니다.

watchsetValue를 사용한 controlled input 구현이 올바르며, shouldValidate: true 옵션도 적절합니다.


104-105: controlled input 프로퍼티가 올바릅니다.

valueonChange를 사용한 controlled input 구현이 적절합니다.

src/pages/event/ui/create-event/EventOrganizerInfoPage.tsx (2)

38-41: controlled input 핸들러가 올바릅니다.

포맷팅과 유효성 검사를 동시에 처리하는 핸들러가 적절히 구현되었습니다.


66-72: UI 개선사항이 적절합니다.

라벨을 "연락처"로 변경하고 placeholder에 예시 형식을 보여주는 것이 사용자 경험 측면에서 좋습니다.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 6, 2025

Copy link
Copy Markdown
Contributor

@Yejiin21 Yejiin21 left a comment

Choose a reason for hiding this comment

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

수고하셨습니당

@xaexunxang xaexunxang merged commit 399a5ff into develop Jun 7, 2025
2 checks passed
@xaexunxang xaexunxang deleted the refact/#165/number-hyphen branch June 7, 2025 03:54
@xaexunxang xaexunxang added the 🪄 Refactoring 코드 리팩토링 label Jun 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🪄 Refactoring 코드 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[refactor] 전화번호 입력 시 자동 하이픈 생성

2 participants