-
Notifications
You must be signed in to change notification settings - Fork 4
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
랭킹 UI와 hook 연결 및 msw 도입 (+변경된 랭킹 객체 타입 적용) #525
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d4d8b8d
feat: (#521) 변경된 랭킹 관련 타입 속성명 적용
chsua cb0aac3
feat: (#521) 사용자 열정랭킹, 열정유저 랭킹, 인기글 랭킹 api msw 생성
chsua d1314b1
feat: (#521) 변경된 랭킹 관련 타입 속성명 적용
chsua 81656ba
fix: 열정유저 랭킹, 인기글 랭킹 api, 쿼리훅에서 타입 오지정 수정
chsua bbf71f1
fix: 사용자 랭킹 쿼리훅 함수명이 열정유저 랭킹 쿼리훅 함수명과 동일한 오류 수정
chsua 7411132
feat: (#521) 사용자 랭킹정보 서스펜스 및 에러바운더리 적용을 위한 분리 및 적용
chsua 045bc4a
feat: (#521) 열정랭킹 테이블, 인기글랭킹 테이블 에러바운더리, 서스펜스 적용
chsua 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
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
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
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
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
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,50 @@ | ||
import { rest } from 'msw'; | ||
|
||
import { PassionUser, RankingPost } from '@type/ranking'; | ||
|
||
const userRankingInfo: PassionUser = { | ||
ranking: 1111, | ||
nickname: 'wow', | ||
postCount: 1, | ||
voteCount: 3, | ||
score: 8, | ||
}; | ||
|
||
const rankerInfo: PassionUser = { | ||
ranking: 1, | ||
nickname: 'gil-dong', | ||
postCount: 11, | ||
voteCount: 79, | ||
score: 134, | ||
}; | ||
|
||
const rankerList: PassionUser[] = new Array(10) | ||
.fill(rankerInfo) | ||
.map((ranker, index) => ({ ...ranker, ranking: index + 1 })); | ||
|
||
const rankingPostInfo: RankingPost = { | ||
ranking: 1, | ||
post: { | ||
id: 29, | ||
writer: 'writer', | ||
title: '이것은 엄청나게 많은 투표가 이루어진 대단한 글이지요', | ||
voteCount: 10, | ||
}, | ||
}; | ||
const rankingPostList: RankingPost[] = new Array(10) | ||
.fill(rankingPostInfo) | ||
.map((post, index) => ({ ...post, ranking: index + 1 })); | ||
|
||
export const mockRanking = [ | ||
rest.get('/members/me/ranking', (req, res, ctx) => { | ||
return res(ctx.status(200), ctx.delay(500), ctx.json(userRankingInfo)); | ||
}), | ||
|
||
rest.get('/members/ranking/passion/guest', (req, res, ctx) => { | ||
return res(ctx.status(200), ctx.delay(1000), ctx.json(rankerList)); | ||
}), | ||
|
||
rest.get('/posts/ranking/popular/guest', (req, res, ctx) => { | ||
return res(ctx.status(200), ctx.delay(500), ctx.json(rankingPostList)); | ||
}), | ||
]; |
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
25 changes: 25 additions & 0 deletions
25
frontend/src/pages/Ranking/PassionUser/UserRanking/index.tsx
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,25 @@ | ||
import React, { useContext } from 'react'; | ||
|
||
import { AuthContext } from '@hooks/context/auth'; | ||
import { useUserRanking } from '@hooks/query/ranking/useUserRanking'; | ||
|
||
import * as S from '../style'; | ||
|
||
export default function UserRanking() { | ||
const { loggedInfo } = useContext(AuthContext); | ||
const { isLoggedIn } = loggedInfo; | ||
|
||
const { data: userRanking } = useUserRanking(isLoggedIn); | ||
|
||
return ( | ||
userRanking && ( | ||
<S.Tr> | ||
<S.Td>{userRanking.ranking}</S.Td> | ||
<S.Td>{userRanking.nickname}</S.Td> | ||
<S.Td>{userRanking.postCount}</S.Td> | ||
<S.Td>{userRanking.voteCount}</S.Td> | ||
<S.Td>{userRanking.score}</S.Td> | ||
</S.Tr> | ||
) | ||
); | ||
} |
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
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
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
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
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
Oops, something went wrong.
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.
호오.. 레전드 선언형 코드인걸요?