-
Notifications
You must be signed in to change notification settings - Fork 2
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/#247 스와이프 기능 구현 #319
Feat/#247 스와이프 기능 구현 #319
Conversation
1. 기존 nowPlayingTrack 상태에 사용된 rank는 변동 가능한 값이므로 part의 id로 변경 2. 이에 따른 props 변경
api 응답 type 그대로 받도록 수정
1. 테스트가 끝난 컴포넌트의 상태를 공유하기 위해 변경하였음. 2. 파일명 변경
1. 기존 isPlaying은 플레이어의 play와 혼동이 생길 가능성이 많았음. 개선을 통해 플레이중인 트랙이라는 의미를 강조함 2. 이에따라 props가 변경되었음
1. 플레이어 초기화 이후 ref에 할당하도록 개선 2. 관련 이벤트 핸들러 생성
1. 타이머, 플레이어 프로바이더의 함수에서 pause 관련 함수 제거 2. 트랙 컴포넌트의 타이머가 영상 상태와 동기화 되도록 수정
실행중인 파트 기준이 rank -> partId 로 변경됨에 따라 로직을 삭제함
기존: onStateChange 에 직접 할당(간헐적 에러 발생) 개선 후: onReady 이후에 onStateChange 이벤트를 바인딩 하도록 변경
기존 최초 1회 무조건 실행하던 fetch를 인자에 따라 조건부로 실행하도록 수정
함수명에서 entries를 제거하여 첫 fetch 함수와 구분
|
||
interface SongDetailItemProps extends SongDetail {} | ||
|
||
const SongDetailItem = forwardRef<HTMLDivElement, SongDetailItemProps>( |
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.
상위에서 첫 랜더링 시 해당 컴포넌트의 위치로 스크롤 해야하는 정책이 있었기에 forwardRef를 사용하였습니다.
@@ -20,26 +21,23 @@ async function main() { | |||
}); | |||
} | |||
|
|||
await loadIFrameApi(); |
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.
유튜브 I frame 로드 api는 최초 1회만 실행되면 되므로 index.tsx로 위치 변경하였습니다.
'top' | ||
); | ||
|
||
const itemRef = useRef<HTMLDivElement>(null); |
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.
사용자가 선택한 노래에 해당하는 SongItem Ref 입니다.
스크롤 이동에 사용됩니다.
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.
스와이프를 구현을 위한 무한스크롤에 필요한 fetch hook을 구현했습니다.
데이터가 쌓일 방향을 인자로 받아, 기존 데이터 배열에 누적해주는 구조입니다.
📝작업 내용
API 로직
스와이프 관련 Page
주요 기능
스와이프
사용성
💬리뷰 참고사항
코드에 대해서는 코멘트에 자세하게 작성하였습니다.
참고해주세요!
#️⃣연관된 이슈
close #247