Skip to content

Conversation

@minimo-9
Copy link
Contributor

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

📌 변경 사항 개요

알림 표시 기능 구현

📝 상세 내용

총 알림 갯수를 가져와서 알림이 있을 때는 숫자로 몇개 있는지 표현하고 없으면 아무것도 안 나오도록 했습니다.

🔗 관련 이슈

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

image image

💡 참고 사항

Summary by CodeRabbit

  • New Features

    • 헤더의 알림 벨 아이콘에 알림이 있을 때 빨간 배지로 총 알림 개수를 표시합니다.
  • Style

    • 알림 벨 버튼과 스켈레톤 플레이스홀더의 CSS 클래스가 일부 조정되었습니다.

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

coderabbitai bot commented Aug 3, 2025

Walkthrough

Header 컴포넌트가 이제 useNotifications 훅을 사용하여 최근 10개의 알림을 가져오고, 알림 개수에 따라 빨간 배지로 알림 개수를 표시합니다. 알림 벨 버튼의 CSS 클래스가 조정되었으며, 스켈레톤 플레이스홀더의 클래스 순서가 소폭 변경되었습니다.

Changes

Cohort / File(s) Change Summary
Header 알림 배지 및 스타일 개선
src/components/Header.tsx
알림 훅(useNotifications) 도입, 알림 개수에 따른 빨간 배지 표시, 벨 버튼 CSS 클래스 relative 추가, 스켈레톤 div 클래스 순서 재조정

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Poem

🛎️
알림이 와르르, 벨이 반짝!
빨간 배지가 깡총, 숫자도 착착.
토끼가 헤더 위를 뛰노네,
새 소식 가득, 오늘도 설레네.
CSS도 정돈, 코드도 반듯!
🐇✨

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/126

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
Contributor

@evaain706 evaain706 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

@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.

수고하셨습니다!

@minimo-9 minimo-9 merged commit 4c9f0a3 into develop Aug 3, 2025
1 of 2 checks passed
@minimo-9 minimo-9 deleted the feat/126 branch August 3, 2025 10:36
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.

고생하셨습니다!

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 658ba01 and d4143ed.

📒 Files selected for processing (1)
  • src/components/Header.tsx (4 hunks)
🧰 Additional context used
🪛 Biome (2.1.2)
src/components/Header.tsx

[error] 85-89: 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 (4)
src/components/Header.tsx (4)

13-13: 알림 기능을 위한 훅 import가 적절합니다.

새로운 알림 표시 기능을 위해 useNotifications 훅을 import한 것이 올바릅니다.


24-25: 알림 데이터 fetching과 상태 관리가 적절합니다.

useNotifications 훅을 사용하여 최신 10개의 알림을 가져오고, nullish coalescing을 통해 totalCount가 undefined인 경우를 안전하게 처리하고 있습니다.


58-59: 스켈레톤 플레이스홀더의 클래스 순서 변경이 확인됩니다.

CSS 클래스의 순서가 변경되었지만 시각적 효과에는 영향이 없습니다.


24-92: 전체적인 알림 표시 기능 구현이 우수합니다.

  • 커스텀 훅을 통한 깔끔한 데이터 fetching
  • 조건부 렌더링을 통한 효율적인 UI 표시
  • 기존 컴포넌트 구조와의 자연스러운 통합

이 구현은 React 모범 사례를 잘 따르고 있으며 유지보수가 용이합니다.

aria-label='알림'
onClick={toggleOpen}
className='hover:text-primary'
className='hover:text-primary relative'
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

버튼에 명시적인 type 속성을 추가하세요.

relative 포지셔닝 추가는 알림 배지를 위해 적절하지만, 버튼에 명시적인 type="button" 속성을 추가해야 합니다.

              <button
                aria-label='알림'
                onClick={toggleOpen}
-                className='hover:text-primary relative'
+                type="button"
+                className='hover:text-primary relative'
              >
🧰 Tools
🪛 Biome (2.1.2)

[error] 85-89: 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/Header.tsx at line 85, the button element lacks an explicit
type attribute, which can cause unintended form submissions. Add the attribute
type="button" to the button element to clearly specify its behavior as a button
and prevent default form submission.

Comment on lines +88 to +92
{hasNotification && (
<span className='font-regular absolute top-[-11px] right-[-3px] text-[10px] text-red-500'>
{data?.totalCount}
</span>
)}
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

알림 배지 구현이 기능적으로 올바르지만 개선사항이 있습니다.

조건부 렌더링과 위치 지정이 적절하게 구현되었습니다. 다음 개선사항을 고려해보세요:

  1. 큰 숫자에 대한 최대 표시 제한 (예: 99+)
  2. 접근성을 위한 최소 폰트 크기 준수

큰 알림 개수에 대한 처리를 위해 다음과 같이 개선할 수 있습니다:

                {hasNotification && (
-                  <span className='font-regular absolute top-[-11px] right-[-3px] text-[10px] text-red-500'>
-                    {data?.totalCount}
+                  <span className='font-regular absolute top-[-11px] right-[-3px] text-[11px] text-red-500'>
+                    {(data?.totalCount ?? 0) > 99 ? '99+' : data?.totalCount}
                  </span>
                )}
📝 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
{hasNotification && (
<span className='font-regular absolute top-[-11px] right-[-3px] text-[10px] text-red-500'>
{data?.totalCount}
</span>
)}
{hasNotification && (
<span className='font-regular absolute top-[-11px] right-[-3px] text-[11px] text-red-500'>
{(data?.totalCount ?? 0) > 99 ? '99+' : data?.totalCount}
</span>
)}
🤖 Prompt for AI Agents
In src/components/Header.tsx around lines 88 to 92, the notification badge
currently displays the totalCount directly, which can cause layout issues with
large numbers. Modify the rendering logic to cap the displayed number at a
maximum value like "99+" when totalCount exceeds 99. Also, increase the font
size to meet accessibility standards by setting a minimum font size of at least
12px or as per design guidelines.

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] 알림 표시 기능

5 participants