Skip to content

refact: scroll 위치 변경 및 간격 조정#202

Merged
hyeeuncho merged 3 commits intodevelopfrom
refactor/#201/all-event-refact
Jun 30, 2025
Merged

refact: scroll 위치 변경 및 간격 조정#202
hyeeuncho merged 3 commits intodevelopfrom
refactor/#201/all-event-refact

Conversation

@hyeeuncho
Copy link
Copy Markdown
Member

@hyeeuncho hyeeuncho commented Jun 30, 2025

Summary by CodeRabbit

  • New Features
    • 이벤트 목록이 무한 스크롤과 가상화 기능을 통해 더 부드럽고 빠르게 로드됩니다.
    • 2열 그리드 레이아웃으로 이벤트가 깔끔하게 정렬되어 시각적 편의성이 향상되었습니다.
  • Style
    • 데스크톱 이벤트 카드의 높이가 약간 줄어들었습니다.
    • 이벤트 목록 컨테이너에 하단 여백이 추가되어 스크롤 영역이 개선되었습니다.

@hyeeuncho hyeeuncho linked an issue Jun 30, 2025 that may be closed by this pull request
@hyeeuncho hyeeuncho self-assigned this Jun 30, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jun 30, 2025

Walkthrough

이 변경 사항은 이벤트 리스트 UI에서 기존의 수동 가상화 및 반응형 레이아웃 로직을 제거하고, react-virtuosoVirtuosoGrid 컴포넌트를 사용하여 가상화와 무한 스크롤을 구현하도록 변경합니다.

Changes

파일/경로 변경 요약
src/features/event/ui/EventList.tsx useVirtualizer 및 수동 가상화 제거, VirtuosoGrid로 대체, 무한 스크롤 및 2열 그리드 구현, 이벤트 카드 렌더링 및 로딩 상태 처리

Possibly related PRs

Suggested labels

🔧 Feature

Suggested reviewers

  • Yejiin21

Poem

🐇
가상화는 이제 맡겼네,
스크롤도 척척, 그리드도 척척,
코드가 한결 가벼워졌네!
이벤트가 줄줄이 춤추며,
토끼도 기분 좋게 깡충깡충!
🎉✨

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

@hyeeuncho hyeeuncho added the 🪄 Refactoring 코드 리팩토링 label Jun 30, 2025
@github-actions
Copy link
Copy Markdown

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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between df4184d and d457a86.

📒 Files selected for processing (1)
  • src/features/event/ui/EventList.tsx (2 hunks)
🔇 Additional comments (1)
src/features/event/ui/EventList.tsx (1)

31-31: 카드 높이 상수 조정이 적절합니다

데스크톱 카드 높이를 350에서 330으로 조정한 것은 가상화 성능 향상에 도움이 됩니다. 실제 EventCard 높이와 더 정확히 맞추면 가상 스크롤의 높이 추정이 개선됩니다.

@github-actions
Copy link
Copy Markdown

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.

기존 react-virtual에서 virtuoso로 변경하여 내부 스크롤 없애도록 수정한거 확인했습니다:)
수고하셨습니다!

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

🧹 Nitpick comments (1)
src/features/event/ui/EventList.tsx (1)

64-66: VirtuosoGrid의 네이티브 그리드 기능 활용을 고려해보세요.

현재 CSS 클래스로 그리드 레이아웃을 구현하고 있지만, VirtuosoGrid는 totalCountcomponents props를 통해 더 효율적인 그리드 지원을 제공합니다.

-        listClassName="flex flex-wrap justify-between"
-        itemClassName="w-[48%] mb-4 cursor-pointer"
+        totalCount={flatEvents.length}
+        components={{
+          Item: ({ children, ...props }) => (
+            <div {...props} className="w-[48%] mb-4 cursor-pointer">
+              {children}
+            </div>
+          ),
+          List: ({ children, ...props }) => (
+            <div {...props} className="flex flex-wrap justify-between">
+              {children}
+            </div>
+          ),
+        }}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 911db6c and 04c2f63.

📒 Files selected for processing (1)
  • src/features/event/ui/EventList.tsx (2 hunks)
🔇 Additional comments (3)
src/features/event/ui/EventList.tsx (3)

1-6: import 변경사항이 적절합니다.

VirtuosoGrid 컴포넌트와 useNavigate 훅의 추가가 새로운 구현에 맞게 잘 구성되어 있습니다.


42-52: 빈 이벤트 목록 처리가 잘 구현되었습니다.

조건부 렌더링을 통해 빈 목록 상태를 효율적으로 처리하고, 태그/카테고리별로 적절한 메시지를 표시합니다.


57-57: 이전 리뷰 우려사항이 적절히 해결되었습니다.

style={{ height: '80vh', width: '90%', margin: '0 auto' }}로 고정 높이가 명시적으로 설정되어 있어, 이전 리뷰에서 제기된 가상화 동작 문제가 해결되었습니다.

Comment on lines +56 to +80
<VirtuosoGrid
style={{ height: '80vh', width: '90%', margin: '0 auto' }} // 높이 명시 필수!
useWindowScroll={true} // 전체 창 스크롤 아니라면 false 권장
data={flatEvents}
endReached={() => {
if (hasNextPage && !isFetching) fetchNextPage();
}}
overscan={200}
listClassName="flex flex-wrap justify-between"
itemClassName="w-[48%] mb-4 cursor-pointer"
itemContent={(_index, event) => (
<EventCard
key={event.id}
id={event.id}
img={event.bannerImageUrl}
eventTitle={event.title}
eventDate={event.startDate}
location={event.address}
host={event.hostChannelName}
hashtags={event.hashtags}
dDay={event.remainDays}
onClick={() => navigate(`/event-details/${event.id}`)}
/>
)}
/>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

VirtuosoGrid 구현에서 스크롤 동작을 검토해주세요.

useWindowScroll={true} 설정으로 인해 전체 페이지 스크롤을 사용하게 되는데, 이것이 의도된 동작인지 확인이 필요합니다.

개선 제안:

  1. 컨테이너 기반 스크롤을 원한다면 useWindowScroll={false}로 변경
  2. overscan={200}은 다소 높은 값으로, 성능에 영향을 줄 수 있습니다. 기본값(50-100) 사용 권장
-        useWindowScroll={true}  // 전체 창 스크롤 아니라면 false 권장
+        useWindowScroll={false}
-        overscan={200}
+        overscan={100}
📝 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
<VirtuosoGrid
style={{ height: '80vh', width: '90%', margin: '0 auto' }} // 높이 명시 필수!
useWindowScroll={true} // 전체 창 스크롤 아니라면 false 권장
data={flatEvents}
endReached={() => {
if (hasNextPage && !isFetching) fetchNextPage();
}}
overscan={200}
listClassName="flex flex-wrap justify-between"
itemClassName="w-[48%] mb-4 cursor-pointer"
itemContent={(_index, event) => (
<EventCard
key={event.id}
id={event.id}
img={event.bannerImageUrl}
eventTitle={event.title}
eventDate={event.startDate}
location={event.address}
host={event.hostChannelName}
hashtags={event.hashtags}
dDay={event.remainDays}
onClick={() => navigate(`/event-details/${event.id}`)}
/>
)}
/>
<VirtuosoGrid
style={{ height: '80vh', width: '90%', margin: '0 auto' }} // 높이 명시 필수!
useWindowScroll={false}
data={flatEvents}
endReached={() => {
if (hasNextPage && !isFetching) fetchNextPage();
}}
overscan={100}
listClassName="flex flex-wrap justify-between"
itemClassName="w-[48%] mb-4 cursor-pointer"
itemContent={(_index, event) => (
<EventCard
key={event.id}
id={event.id}
img={event.bannerImageUrl}
eventTitle={event.title}
eventDate={event.startDate}
location={event.address}
host={event.hostChannelName}
hashtags={event.hashtags}
dDay={event.remainDays}
onClick={() => navigate(`/event-details/${event.id}`)}
/>
)}
/>
🤖 Prompt for AI Agents
In src/features/event/ui/EventList.tsx between lines 56 and 80, the VirtuosoGrid
component uses useWindowScroll={true}, which enables full page scrolling; verify
if this is intended. If container-based scrolling is preferred, change
useWindowScroll to false. Also, reduce overscan from 200 to a value between 50
and 100 to improve performance by limiting offscreen item rendering.

@github-actions
Copy link
Copy Markdown

@hyeeuncho hyeeuncho merged commit 387c9af into develop Jun 30, 2025
2 checks passed
@hyeeuncho hyeeuncho deleted the refactor/#201/all-event-refact branch June 30, 2025 06:35
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