-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: follower, following list 마크업 및 데이터 연동 #251
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
387fd9c
feat: profile follower, following list 마크업 및 데이터 연동
Jungjjeong 00897e0
feat: profile list 페이지 컴포넌트 적용
Jungjjeong c43ff5b
fix: contents, reactions 비어있을 때 예외처리
Jungjjeong 7317da9
feat: profile list item 수정
Jungjjeong d8e4882
feat: profile follow list 성능 개선
Jungjjeong 4ac1fd7
feat: profile 페이지 이동 기능 추가
Jungjjeong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React from 'react'; | ||
import { Virtuoso } from 'react-virtuoso'; | ||
|
||
import { ProfileListItem } from '@/components/molecules'; | ||
|
||
import { ProfileFollowContent } from '../types'; | ||
|
||
type FollowVirtualList = { | ||
data: ProfileFollowContent[]; | ||
fetchNextData: () => void; | ||
}; | ||
export const FollowVirtualList = ({ | ||
data, | ||
fetchNextData, | ||
}: FollowVirtualList) => { | ||
const handleRangeChanged = (range: { endIndex: number }) => { | ||
const currentContentsLastIndex = data.length - 1; | ||
if (range.endIndex >= currentContentsLastIndex - 3) { | ||
void fetchNextData(); | ||
} | ||
}; | ||
|
||
return ( | ||
<Virtuoso | ||
data={data} | ||
overscan={300} | ||
useWindowScroll | ||
rangeChanged={handleRangeChanged} | ||
itemContent={(_, item) => <ProfileListItem isFollow={true} {...item} />} | ||
style={{ | ||
width: '100%', | ||
height: '100%', | ||
}} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './follow-virtual-list'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use client'; | ||
|
||
import { useFollowerList } from '../apis'; | ||
import { FollowVirtualList } from '../components'; | ||
|
||
export const FollowerSection = ({ id }: { id: number }) => { | ||
const { flattenData, hasNextPage, isFetchingNextPage, fetchNextPage } = | ||
useFollowerList(id); | ||
|
||
const fetchNextData = () => { | ||
if (hasNextPage && !isFetchingNextPage) { | ||
void fetchNextPage(); | ||
} | ||
}; | ||
|
||
return <FollowVirtualList data={flattenData} fetchNextData={fetchNextData} />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use client'; | ||
|
||
import { useFollowingList } from '../apis'; | ||
import { FollowVirtualList } from '../components'; | ||
|
||
export const FollowingSection = ({ id }: { id: number }) => { | ||
const { flattenData, hasNextPage, isFetchingNextPage, fetchNextPage } = | ||
useFollowingList(id); | ||
|
||
const fetchNextData = () => { | ||
if (hasNextPage && !isFetchingNextPage) { | ||
void fetchNextPage(); | ||
} | ||
}; | ||
|
||
return <FollowVirtualList data={flattenData} fetchNextData={fetchNextData} />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export * from './follow-tab'; | ||
export * from './follower-section'; | ||
export * from './following-section'; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
근데 왜 이거 -3 까지예요? (궁 금 궁 금)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그냥 제가 정한 기준이긴 해요
뷰포트 기준으로 overscan 500px + end index 3개 전에 다음 데이터 불러오는 조건입니다!