Open
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the sorting logic for games in the RecentTab component to prioritize them by state (Playing, Scheduled, then Finished) and then by start time. Feedback was provided to optimize performance by moving the state order object outside the sort callback, and to improve the user experience by updating the button label logic and reversing the sort order for finished games to show the most recent ones first.
Comment on lines
+27
to
+36
| // gameState가 PLAYING인 경기, SCHEDULED인 경기, FINISHED인 경기 순으로 정렬 | ||
| // 각 경기 상태 내에서는 시작 시간이 빠른 순으로 정렬 | ||
| const sortedGames = [...displayedGame.games].sort((a, b) => { | ||
| const gameStateOrder = { PLAYING: 0, SCHEDULED: 1, FINISHED: 2 }; | ||
| const aOrder = gameStateOrder[a.gameState]; | ||
| const bOrder = gameStateOrder[b.gameState]; | ||
|
|
||
| if (aOrder !== bOrder) return aOrder - bOrder; | ||
| return new Date(a.startTime).getTime() - new Date(b.startTime).getTime(); | ||
| }); |
Contributor
There was a problem hiding this comment.
정렬 로직의 효율성과 변경된 순서에 따른 UX 영향을 검토해 주세요.
- 성능 최적화:
gameStateOrder객체가 정렬 콜백 함수 내부에서 매번 생성되고 있습니다. 이를 콜백 외부로 이동시켜 불필요한 객체 생성을 방지하는 것이 좋습니다. - UX 일관성:
- 버튼 문구:
PLAYING경기가 없고SCHEDULED경기가 있는 경우, 목록 최상단에는 예정 경기가 오지만 하단 버튼(25번 라인)은 여전히 "지난 경기 보러가기"로 표시됩니다. 예정 경기가 우선순위가 된 만큼 버튼 문구 로직도 수정이 필요해 보입니다. - 종료 경기 순서:
FINISHED상태의 경기를 시작 시간 오름차순으로 정렬하면 가장 오래된 경기가 먼저 노출됩니다. 일반적으로 '최근 경기' 탭에서는 종료된 경기를 최신순(내림차순)으로 보여주는 것이 사용자 기대에 부합할 수 있습니다.
- 버튼 문구:
Suggested change
| // gameState가 PLAYING인 경기, SCHEDULED인 경기, FINISHED인 경기 순으로 정렬 | |
| // 각 경기 상태 내에서는 시작 시간이 빠른 순으로 정렬 | |
| const sortedGames = [...displayedGame.games].sort((a, b) => { | |
| const gameStateOrder = { PLAYING: 0, SCHEDULED: 1, FINISHED: 2 }; | |
| const aOrder = gameStateOrder[a.gameState]; | |
| const bOrder = gameStateOrder[b.gameState]; | |
| if (aOrder !== bOrder) return aOrder - bOrder; | |
| return new Date(a.startTime).getTime() - new Date(b.startTime).getTime(); | |
| }); | |
| // gameState가 PLAYING인 경기, SCHEDULED인 경기, FINISHED인 경기 순으로 정렬 | |
| // 각 경기 상태 내에서는 시작 시간이 빠른 순으로 정렬 | |
| const gameStateOrder = { PLAYING: 0, SCHEDULED: 1, FINISHED: 2 }; | |
| const sortedGames = [...displayedGame.games].sort((a, b) => { | |
| const aOrder = gameStateOrder[a.gameState]; | |
| const bOrder = gameStateOrder[b.gameState]; | |
| if (aOrder !== bOrder) return aOrder - bOrder; | |
| return new Date(a.startTime).getTime() - new Date(b.startTime).getTime(); | |
| }); |
Contributor
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

✅ 작업 내용
📝 참고 자료
♾️ 기타