Skip to content

refactor(ADMIN-207): alert 기능 수정 - #4

Merged
seyun31 merged 3 commits into
mainfrom
refactor/admin-207-alert
Sep 11, 2025
Merged

refactor(ADMIN-207): alert 기능 수정#4
seyun31 merged 3 commits into
mainfrom
refactor/admin-207-alert

Conversation

@seyun31

@seyun31 seyun31 commented Sep 11, 2025

Copy link
Copy Markdown
Contributor
  • feat: toast 알림 추가
  • refactor: QR 스캔에서 alert부분 toast 알림으로 변경
  • feat: 카메라 새로고침 기능 추가 및 로그아웃 시 알림 기능 추가

Summary by CodeRabbit

  • New Features
    • 앱 전역 토스트 알림 도입(성공/오류), 커스텀 확인 모달 지원
    • QR 스캐너에 카메라 새로고침 버튼, 중복 스캔 방지, 스캔 성공/실패 토스트 추가
  • Refactor
    • 브라우저 alert/confirm을 통합 알림으로 교체하여 일관된 피드백 제공
    • 활동 생성/수정/삭제 후 목록 자동 새로고침
    • 로그인/로그아웃 시 사용자 피드백 개선 및 불필요한 메시지 억제
  • Style
    • 로그인 버튼에 커서 포인터 적용
  • Chores
    • 토스트 알림 라이브러리 의존성 추가

@seyun31 seyun31 self-assigned this Sep 11, 2025
@coderabbitai

coderabbitai Bot commented Sep 11, 2025

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

Walkthrough

react-toastify를 도입해 전역 토스트 컨테이너를 추가하고, 기존 alert/confirm 사용처를 통일된 알림 유틸로 교체했습니다. QR 스캐너의 스캔 처리/쓰로틀/카메라 새로고침 흐름을 재구성했으며, 일부 API 에러 처리 메시지와 반환값 일관성을 보강했습니다. 스타일 소폭 수정이 포함됩니다.

Changes

Cohort / File(s) Change Summary
알림 인프라 도입
package.json, src/App.tsx, src/utils/alert.tsx
react-toastify 의존성 추가 및 전역 ToastContainer 렌더링. 알림 유틸 모듈 신설: showError/showSuccess/showWarning/showConfirm/showCustomConfirm 구현(커스텀 확인 모달 포함).
API 에러 핸들링 정비
src/api/activity/post-memebr-activities.ts, src/api/auth/logout.ts, src/api/auth/members.ts
alert 제거 후 알림 유틸로 교체. HTTP 오류 시 조기 반환(false) 추가 등 반환값 일관화. 로그인 페이지에서 환영 메시지 억제 가드 추가 및 세션 스토리지 플래그 도입. 로그아웃 함수 실패 시 false 반환 보장.
컴포넌트 알림 통일 및 플로우 보완
src/components/EventTable.tsx, src/components/Header.tsx
EventTable: 생성/수정/삭제/검증 시 알림 유틸 사용, 삭제 확인을 비동기 경고로 처리, 생성 시 PostMemberActivities 호출 및 목록 새로고침. Header: 로그아웃 시 커스텀 확인 모달 비동기 처리, 성공/실패 토스트 및 라우팅 유지.
QR 스캔 흐름 재구성
src/components/QRScanner.tsx
알림 유틸 도입 및 로컬 오류 상태 제거. 스캔 콜백 내 비동기 처리/쓰로틀(중복 방지) 추가, localStorage의 활동 ID 확인, QR→회원 조회→참석 등록 호출, 성공/실패 토스트. 카메라 새로고침 핸들러 추가 및 언마운트 정리 로직 조정.
UI 스타일 사소 변경
src/page/login.tsx
로그인 버튼에 cursor-pointer 클래스 추가.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant H as Header
  participant A as alert.tsx (showCustomConfirm)
  participant Auth as logout()
  participant R as Router

  U->>H: 로그아웃 버튼 클릭
  H->>A: showCustomConfirm("로그아웃 하시겠습니까?")
  A-->>H: Promise<boolean> (확인/취소)

  alt 확인(true)
    H->>Auth: logout()
    Auth-->>H: Promise<boolean> (성공/실패)
    alt 성공
      H->>A: showSuccess("로그아웃 성공")
      H->>R: navigate('/login')
    else 실패
      H->>A: showError("로그아웃 실패")
    end
  else 취소(false)
    Note right of H: 동작 없음
  end
Loading
sequenceDiagram
  autonumber
  participant Q as QRScanner
  participant LS as localStorage
  participant API1 as GetQRCode(uuid)
  participant API2 as PostMemberActivities(activityId, memberId)
  participant A as alert.tsx

  Q->>Q: QR 인식 콜백(쓰로틀 검사)
  Q->>LS: getItem('currentActivityId')
  alt 활동 ID 없음
    Q->>A: showError("활동 ID 없음")
    Note right of Q: 조기 종료
  else 활동 ID 있음
    Q->>API1: 회원 조회(uuid)
    alt 조회 성공
      API1-->>Q: memberId
      Q->>API2: 참석 등록(activityId, memberId)
      alt 등록 성공
        Q->>A: showSuccess("참석 등록 성공")
        Note right of Q: 쓰로틀 해제 타이머
      else 등록 실패
        Q->>A: showError("참석 등록 실패")
      end
    else 조회 실패
      Q->>A: showError("회원 조회 실패")
    end
  end

  Q->>Q: 카메라 새로고침 버튼
  Q->>Q: 기존 스캐너 stop/start 또는 재초기화
  Q->>A: showSuccess("카메라 새로고침 완료")
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 705a67e and 8994c1b.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (10)
  • package.json (1 hunks)
  • src/App.tsx (2 hunks)
  • src/api/activity/post-memebr-activities.ts (2 hunks)
  • src/api/auth/logout.ts (2 hunks)
  • src/api/auth/members.ts (2 hunks)
  • src/components/EventTable.tsx (7 hunks)
  • src/components/Header.tsx (2 hunks)
  • src/components/QRScanner.tsx (5 hunks)
  • src/page/login.tsx (1 hunks)
  • src/utils/alert.tsx (1 hunks)
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/admin-207-alert

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.

@seyun31
seyun31 merged commit 7d455ae into main Sep 11, 2025
1 of 2 checks passed
@seyun31
seyun31 deleted the refactor/admin-207-alert branch September 11, 2025 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant