Skip to content

Conversation

@minimo-9
Copy link
Contributor

@minimo-9 minimo-9 commented Aug 4, 2025

📌 변경 사항 개요

알림 클릭 시 예약 내역 페이지로 이동

📝 상세 내용

알림 내역을 클릭하면 예약 내역으로 이동 하도록 구현했습니다. 이동 시 해당 알림은 삭제 됩니다.
이동 시 드롭다운은 자동으로 닫히게 했습니다.

🔗 관련 이슈

🖼️ 스크린샷(선택사항)

compressed_output

💡 참고 사항

Summary by CodeRabbit

  • 신규 기능

    • 알림 카드 클릭 시 알림이 삭제되고 예약 페이지로 이동하는 기능이 추가되었습니다.
  • 버그 수정

    • 알림 삭제 실패 시 오류 토스트 메시지가 표시됩니다.
  • 기타

    • 알림 카드 리스트와 드롭다운에서 알림 카드 클릭 시 추가 동작(onCardClick)이 가능하도록 개선되었습니다.

@minimo-9 minimo-9 self-assigned this Aug 4, 2025
@minimo-9 minimo-9 added the ✨ Feature 기능구현 label Aug 4, 2025
@minimo-9 minimo-9 linked an issue Aug 4, 2025 that may be closed by this pull request
@coderabbitai
Copy link

coderabbitai bot commented Aug 4, 2025

Walkthrough

알림(Notification) 카드와 관련된 컴포넌트 전반에 걸쳐 클릭 시 알림 삭제 및 페이지 이동 기능이 추가되었습니다. 주요 변경점은 NotificationCard에 onCardClick 프로퍼티와 비동기 삭제 로직이 도입되고, 이 클릭 핸들러가 상위 컴포넌트(NotificationCardList, NotificationDropdown)까지 전달되도록 확장된 것입니다. 삭제 실패 시 토스트 에러도 표시됩니다.

Changes

Cohort / File(s) Change Summary
NotificationCard 컴포넌트 개선
src/components/Notification/NotificationCard.tsx
알림 카드 클릭 시 알림 삭제 및 예약 페이지 이동 기능 추가, onCardClick 프로퍼티 도입, 삭제 로직 비동기화, 에러 토스트 처리 추가
NotificationCardList 컴포넌트 확장
src/components/Notification/NotificationCardList.tsx
onCardClick 프로퍼티 도입 및 하위 NotificationCard로 전달, 인터페이스 및 파라미터 수정
NotificationDropdown 컴포넌트 연결
src/components/Notification/NotificationDropdown.tsx
NotificationCardList에 onCardClick=onClose 전달하여 드롭다운 닫기 기능 연동
알림 삭제 훅 에러 처리
src/hooks/useDeleteNotification.ts
삭제 실패 시 토스트 에러 메시지 표시(onError 콜백 추가), sonner 라이브러리 import 추가

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant NotificationCard
    participant useDeleteNotification
    participant Router
    participant Toast

    User->>NotificationCard: 카드 클릭
    NotificationCard->>useDeleteNotification: mutateAsync(알림 삭제)
    alt 삭제 성공
        useDeleteNotification-->>NotificationCard: 성공 응답
        NotificationCard->>Router: /mypage/reservations로 이동
        NotificationCard->>상위 onCardClick: (옵션) 콜백 호출
    else 삭제 실패
        useDeleteNotification-->>NotificationCard: 에러 응답
        NotificationCard->>Toast: 에러 토스트 표시
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers

  • BokyungCodes
  • LeeCh0129

Poem

🐇
알림 카드 콩콩, 한 번 톡!
삭제와 이동, 한 번에 똑!
실패하면 토스트로 땡땡땡,
예약 페이지로 깡총깡총 hop!
개발자의 손길 따라
알림함이 더 똑똑!

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/134

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 generate unit tests to generate unit tests for 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.

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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4c9f0a3 and d111fd0.

📒 Files selected for processing (4)
  • src/components/Notification/NotificationCard.tsx (6 hunks)
  • src/components/Notification/NotificationCardList.tsx (3 hunks)
  • src/components/Notification/NotificationDropdown.tsx (1 hunks)
  • src/hooks/useDeleteNotification.ts (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/components/Notification/NotificationCard.tsx (3)
src/hooks/useDeleteNotification.ts (1)
  • useDeleteNotification (37-49)
src/lib/utils.ts (1)
  • cn (4-6)
src/utils/relativeTime.ts (1)
  • relativeTime (1-15)
🪛 Biome (2.1.2)
src/components/Notification/NotificationCard.tsx

[error] 126-128: Static Elements should not be interactive.

To add interactivity such as a mouse or key event listener to a static element, give the element an appropriate role value.

(lint/a11y/noStaticElementInteractions)


[error] 126-128: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event.

Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.

(lint/a11y/useKeyWithClickEvents)


[error] 114-120: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)

🔇 Additional comments (5)
src/hooks/useDeleteNotification.ts (1)

3-3: 에러 처리 개선이 잘 구현되었습니다.

토스트 알림을 통한 에러 피드백 추가로 사용자 경험이 향상되었습니다. sonner 라이브러리 사용도 코드베이스의 다른 부분과 일관성을 유지하고 있습니다.

Also applies to: 45-47

src/components/Notification/NotificationDropdown.tsx (1)

71-74: 알림 카드 클릭 시 드롭다운 닫기 기능이 적절히 구현되었습니다.

onCardClick prop을 통해 알림 카드 클릭 시 드롭다운이 자동으로 닫히도록 하는 깔끔한 연결이 구현되었습니다.

src/components/Notification/NotificationCardList.tsx (1)

11-11: Props 전달 구조가 적절히 설계되었습니다.

onCardClick prop이 optional로 설계되어 유연성을 제공하고, 각 NotificationCard에 일관되게 전달되는 구조가 잘 구현되었습니다.

Also applies to: 30-30, 148-148

src/components/Notification/NotificationCard.tsx (2)

7-8: 새로운 기능 구현이 잘 되었습니다.

라우터 네비게이션과 에러 처리를 위한 import 추가, onCardClick prop 추가, 그리고 비동기 삭제를 위한 mutateAsync 사용이 적절히 구현되었습니다.

Also applies to: 17-17, 58-59


74-85: 비동기 카드 클릭 핸들러가 잘 구현되었습니다.

알림 삭제, 콜백 호출, 페이지 네비게이션이 순차적으로 처리되고, 에러 발생 시 적절한 토스트 메시지를 표시하는 로직이 잘 구현되었습니다.

Comment on lines 99 to 104
onClick={(e) => {
e.stopPropagation();
setTimeout(() => {
e.stopPropagation();
handleDelete();
}, 0);
}}
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

버튼 타입을 명시해주세요.

정적 분석 도구에서 지적한 대로, button 요소에 명시적인 type을 지정해야 합니다.

다음과 같이 수정해주세요:

        <button
+          type="button"
          onClick={(e) => {
            e.stopPropagation();
            setTimeout(() => {
              handleDelete();
            }, 0);
          }}
          aria-label='알림 삭제'
        >
📝 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
onClick={(e) => {
e.stopPropagation();
setTimeout(() => {
e.stopPropagation();
handleDelete();
}, 0);
}}
<button
type="button"
onClick={(e) => {
e.stopPropagation();
setTimeout(() => {
handleDelete();
}, 0);
}}
aria-label='알림 삭제'
>
🤖 Prompt for AI Agents
In src/components/Notification/NotificationCard.tsx around lines 99 to 104, the
button element lacks an explicit type attribute, which can cause unintended form
submissions. Add a type="button" attribute to the button element to explicitly
specify its behavior and prevent default form submission.

Comment on lines +111 to +129
<div className='cursor-pointer' onClick={handleCardClick}>
<p className='text-md font-regular whitespace-pre-line text-black'>
{formattedContent.split(/(|)/).map((text, i) => {
const matchedStatus = statusKeywordMap[text];
return (
<span
key={i}
className={cn(
matchedStatus && statusColorMap[matchedStatus].text,
)}
>
{text}
</span>
);
})}
</p>

<p className='mt-4 text-xs text-gray-600'>{relativeTime(createdAt)}</p>
<p className='mt-4 text-xs text-gray-600'>{relativeTime(createdAt)}</p>
</div>
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

접근성 개선이 필요합니다.

클릭 가능한 div 요소에 적절한 접근성 속성을 추가해야 합니다. 키보드 네비게이션 지원과 적절한 역할(role)을 제공해주세요.

다음과 같이 수정해주세요:

-      <div className='cursor-pointer' onClick={handleCardClick}>
+      <div 
+        className='cursor-pointer' 
+        onClick={handleCardClick}
+        onKeyDown={(e) => {
+          if (e.key === 'Enter' || e.key === ' ') {
+            e.preventDefault();
+            handleCardClick();
+          }
+        }}
+        role="button"
+        tabIndex={0}
+        aria-label="알림 확인 및 예약 내역으로 이동"
+      >
📝 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
<div className='cursor-pointer' onClick={handleCardClick}>
<p className='text-md font-regular whitespace-pre-line text-black'>
{formattedContent.split(/(|)/).map((text, i) => {
const matchedStatus = statusKeywordMap[text];
return (
<span
key={i}
className={cn(
matchedStatus && statusColorMap[matchedStatus].text,
)}
>
{text}
</span>
);
})}
</p>
<p className='mt-4 text-xs text-gray-600'>{relativeTime(createdAt)}</p>
<p className='mt-4 text-xs text-gray-600'>{relativeTime(createdAt)}</p>
</div>
<div
className='cursor-pointer'
onClick={handleCardClick}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
handleCardClick();
}
}}
role="button"
tabIndex={0}
aria-label="알림 확인 및 예약 내역으로 이동"
>
<p className='text-md font-regular whitespace-pre-line text-black'>
{formattedContent.split(/(|)/).map((text, i) => {
const matchedStatus = statusKeywordMap[text];
return (
<span
key={i}
className={cn(
matchedStatus && statusColorMap[matchedStatus].text,
)}
>
{text}
</span>
);
})}
</p>
<p className='mt-4 text-xs text-gray-600'>{relativeTime(createdAt)}</p>
</div>
🧰 Tools
🪛 Biome (2.1.2)

[error] 126-128: Static Elements should not be interactive.

To add interactivity such as a mouse or key event listener to a static element, give the element an appropriate role value.

(lint/a11y/noStaticElementInteractions)


[error] 126-128: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event.

Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.

(lint/a11y/useKeyWithClickEvents)


[error] 114-120: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)

🤖 Prompt for AI Agents
In src/components/Notification/NotificationCard.tsx around lines 111 to 129, the
clickable div lacks accessibility features. Replace the div with a button
element or add role="button", tabIndex="0", and keyboard event handlers (e.g.,
onKeyDown for Enter and Space keys) to support keyboard navigation and screen
readers. This will ensure the element is focusable and operable via keyboard,
improving accessibility.

Copy link
Contributor

@BokyungCodes BokyungCodes 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
Contributor

@LeeCh0129 LeeCh0129 left a comment

Choose a reason for hiding this comment

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

밤늦게까지 고생하셨습니다! 드디어 내일이면 끝이네요. 마지막까지 화이팅입니다!

@minimo-9 minimo-9 merged commit 64ef4f4 into develop Aug 4, 2025
2 checks passed
@minimo-9 minimo-9 deleted the feat/134 branch August 4, 2025 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ Feature 기능구현

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] 알림 카드 클릭 시 이동

4 participants