-
Notifications
You must be signed in to change notification settings - Fork 8
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
[GGFE-44] Style Rank Trophy #807
Changes from 71 commits
ff9e49c
0b7cb15
740b697
b1a8fc9
d131d65
92b004f
b5780f1
ff60165
346a2a1
c233f79
e80ee80
c78eaa6
a3aa065
74b82dc
e720d56
7708a81
02916cf
d1de6ee
d11a2de
a59343e
d3405ff
8eef93b
559098f
184113c
ad02c99
7248fe3
9d8e3a6
1a63e76
b530cd9
ceb4fe4
e25cec5
a74658f
cc2e73a
9784524
3c03283
ae403e1
07fa591
68e3671
7e9555f
4406e76
2de350b
b0ce1e4
9b7fbb2
513222f
9eaec10
9179c4b
49d56ba
79c0af4
e2818d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
import { useState } from 'react'; | ||
import { RankUser, NormalUser, Rank, ToggleMode } from 'types/rankTypes'; | ||
import React, { useState, createContext } from 'react'; | ||
import { RankUser, NormalUser, Rank } from 'types/rankTypes'; | ||
import RankListMain from './topRank/RankListMain'; | ||
import RankListFrame from './RankListFrame'; | ||
import RankListItem from './RankListItem'; | ||
import useRankList from 'hooks/rank/useRankList'; | ||
import { ToggleMode } from 'types/rankTypes'; | ||
|
||
interface RankListProps { | ||
toggleMode: ToggleMode; | ||
season?: number; | ||
isMain?: boolean; | ||
} | ||
export default function RankList({ | ||
toggleMode, | ||
season, | ||
isMain = false, | ||
}: RankListProps) { | ||
const seasonMode = 'RANK'; | ||
export const ToggleModeContext = createContext<'RANK' | 'NORMAL'>('RANK'); | ||
|
||
export default function RankList(prop: RankListProps) { | ||
const { toggleMode, season, isMain } = prop; | ||
const [rank, setRank] = useState<Rank>(); | ||
const [ranker, setRanker] = useState<Rank>(); | ||
const [page, setPage] = useState<number>(1); | ||
const pageInfo = { | ||
currentPage: rank?.currentPage, | ||
|
@@ -29,33 +29,49 @@ export default function RankList({ | |
targetMode !== 'NORMAL' ? 'ranks/single' : 'exp'; | ||
const seasonQuery = toggleMode === 'RANK' ? `&season=${season}` : ''; | ||
return isMain | ||
? `/pingpong/${modeQuery(seasonMode)}?page=1&size=3` | ||
: `/pingpong/${modeQuery(toggleMode)}?page=${page}${seasonQuery}`; | ||
? `/pingpong/${modeQuery(toggleMode)}?page=1&size=3` | ||
: `/pingpong/${modeQuery(toggleMode)}?page=${page}&size=20${seasonQuery}`; | ||
}; | ||
const makePathRanker = (): string => { | ||
const modeQuery = (targetMode?: string) => | ||
targetMode !== 'NORMAL' ? 'ranks/single' : 'exp'; | ||
const seasonQuery = toggleMode === 'RANK' ? `&season=${season}` : ''; | ||
return isMain | ||
? `/pingpong/${modeQuery(toggleMode)}?page=1&size=3` | ||
: `/pingpong/${modeQuery(toggleMode)}?page=1&size=3${seasonQuery}`; | ||
}; | ||
|
||
useRankList({ | ||
makePath: makePath(), | ||
makePathRanker: makePathRanker(), | ||
toggleMode: toggleMode, | ||
season: season, | ||
setRank: setRank, | ||
setRanker: setRanker, | ||
page: page, | ||
setPage: setPage, | ||
pageInfo: pageInfo, | ||
}); | ||
|
||
if (isMain) return <RankListMain rank={rank} />; | ||
if (isMain) { | ||
return <RankListMain rank={ranker} isMain={true} />; | ||
} | ||
|
||
return ( | ||
<RankListFrame toggleMode={toggleMode} pageInfo={pageInfo}> | ||
{rank?.rankList.map((item: NormalUser | RankUser, index) => ( | ||
<RankListItem | ||
key={index} | ||
index={index} | ||
toggleMode={toggleMode} | ||
user={makeUser(item)} | ||
/> | ||
))} | ||
</RankListFrame> | ||
<ToggleModeContext.Provider value={toggleMode}> | ||
<div> | ||
<RankListMain rank={ranker} isMain={false} /> | ||
<RankListFrame toggleMode={toggleMode} pageInfo={pageInfo}> | ||
{rank?.rankList.map((item: NormalUser | RankUser, index) => ( | ||
<RankListItem | ||
key={index} | ||
toggleMode={toggleMode} | ||
user={makeUser(item)} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. makeUser์ ๋ฐํ๊ฐ๋ ํ์ ์ง์ ํด์ฃผ๋ฉด RankListItem์์ ํ์ ๊ฒฝ๊ณ ์์ด์ง ๋ฏ ํฉ๋๋ค! |
||
/> | ||
))} | ||
Comment on lines
+68
to
+74
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๋ง์ฝ์ rank ๋ฐฐ์ด์ ์์๊ฐ 3๊ฐ ๋ฏธ๋ง์ด๋ฉด ์ด๋ป๊ฒ ๋๋์? ์ ๋ฒ์ ์์ฆ ์๋ก ๋ง๋ค์์ ๋ ์์๊ฐ 2๋ฑ๊น์ง์ธ๊ฐ ๋ฐ์ ์์๋ ๊ฒ์ ๋ณธ ์ ์ด ์์๋๋ฐ ๊ทธ๋๋ ๊ทธ๋ฅ ๋น์ด์์๋ ๊ฒ ๊ฐ์์์. ์ง๊ธ์ ์ด๋ป๊ฒ ์ฒ๋ฆฌ๋์ด์๋ ๋ณด๊ณ ์ถ๊ธด ํ๋ฐ ๋ณผ ๋ฐฉ๋ฒ์ด ์๋ค์... (์ด๋ ๊ฒ ์ง์ ํ์ธํด๋ณด๊ธฐ ์ด๋ ค์ด ๊ฒฝ์ฐ์๋ story ๋ง๋ค์ด์ฃผ์๋ฉด ์ข์ ๊ฒ ๊ฐ์์ ๐) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๋ฐฐ์ด์ด ๋ถ๋ถ์ ์ผ๋ก ์์๊ฒฝ์ฐ , ์์์์๊ฒฝ์ฐ ๋ฌผ์ํ๋์ค๊ฒ ์ฒ๋ฆฌํ์ต๋๋ค. ์คํ ๋ฆฌ๋ 1,2,3๋ฑ ๋ฐ์ดํฐ์์๋ ์๋ฌ๊ฐ ๋ ์ 3๋ฑ๋ง ์์๊ฒฝ์ฐ๋ง ํ์ธํ์ต๋๋ค. |
||
</RankListFrame> | ||
</div> | ||
</ToggleModeContext.Provider> | ||
); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,24 +13,22 @@ interface User { | |
} | ||
|
||
interface RankListItemProps { | ||
index: number; | ||
user: User; | ||
toggleMode: ToggleMode; | ||
} | ||
|
||
export default function RankListItem({ | ||
index, | ||
user, | ||
toggleMode, | ||
}: RankListItemProps) { | ||
export default function RankListItem({ user, toggleMode }: RankListItemProps) { | ||
const { rank, intraId, statusMessage, point, level } = user; | ||
const myIntraId = useRecoilValue(userState).intraId; | ||
const wrapStyle = { | ||
evenOdd: index % 2 === 0 ? styles.even : styles.odd, | ||
topStandard: rank < 4 ? styles.top : styles.standard, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ์ฌ๊ธฐ์ ์๋ฌ๋๋๋ฐ ํ์ธํด์ฃผ์ค ์ ์๋์? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ranklist ๋ฐ์ดํฐ๋ฅผ ์ ์๋ ๊ฐ์ ํ ๋ชจ๋ ๋ถ๋ค์ ๋ฐ์์ ํ๋ฒ๋ ์ํ์๊ฒฝ์ฐ์๋ ๋ญํน์ '-'์ด๋ ๊ฒ ํ์ํ๊ธฐ ์ํด์ ์ฌ์ฉํ์์ต๋๋ค. ํ์ฌ๋ ํ์์์ด์ ์์ ํ์ต๋๋ค. |
||
rankItem: { | ||
RANK: styles.Ranking, | ||
NORMAL: styles.Vip, | ||
}, | ||
myRankItem: { | ||
rank: intraId === myIntraId && level === null ? styles.myRanking : '', | ||
normal: intraId === myIntraId && level !== null ? styles.myVip : '', | ||
RANK: intraId === myIntraId && level === null ? styles.myRanking : '', | ||
NORMAL: intraId === myIntraId && level !== null ? styles.myVip : '', | ||
}, | ||
}; | ||
|
||
|
@@ -45,8 +43,8 @@ export default function RankListItem({ | |
|
||
return ( | ||
<div | ||
className={`${styles.rankItemWrap} ${wrapStyle.evenOdd} | ||
${wrapStyle.topStandard} ${wrapStyle.myRankItem[toggleMode]}`} | ||
className={`${styles.rankItemWrap} ${wrapStyle.topStandard} | ||
${wrapStyle.myRankItem[toggleMode]} ${wrapStyle.rankItem[toggleMode]}`} | ||
> | ||
{rank} | ||
<div className={styles.intraId}>{makeIntraIdLink()}</div> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,57 @@ | ||
import Link from 'next/link'; | ||
import React, { useContext } from 'react'; | ||
import { RankUser, NormalUser } from 'types/rankTypes'; | ||
import styles from 'styles/rank/RankListMain.module.scss'; | ||
|
||
import PlayerImage from 'components/PlayerImage'; | ||
import { ToggleModeContext } from '../RankList'; | ||
interface RankListItemMainProps { | ||
user: NormalUser | RankUser; | ||
isSeasonNormal: boolean; | ||
} | ||
|
||
export default function RankListItemMain({ | ||
user, | ||
isSeasonNormal, | ||
}: RankListItemMainProps) { | ||
const { rank, intraId, statusMessage } = user; | ||
const messageFiltered = | ||
statusMessage.length > 10 | ||
? statusMessage.slice(0, 10) + '...' | ||
: statusMessage; | ||
export default function RankListItemMain({ user }: RankListItemMainProps) { | ||
const { rank, intraId, userImageUri } = user; | ||
const rankFiltered = rank < 0 ? '-' : rank; | ||
const toggleMode = useContext(ToggleModeContext); | ||
|
||
return ( | ||
<div | ||
className={`${styles.mainData} | ||
${isSeasonNormal && styles.normal}`} | ||
className={`${styles.mainData} ${ | ||
toggleMode === 'NORMAL' && styles.normal | ||
}`} | ||
> | ||
<div className={styles.rankNumber}>{rankFiltered}</div> | ||
<div className={styles.intraId}> | ||
<Link href={`users/detail?intraId=${intraId}`}> | ||
<span>{intraId}</span> | ||
</Link> | ||
<div | ||
className={`${rank === 1 ? styles.leaf : ''} ${ | ||
toggleMode === 'NORMAL' && styles.normal | ||
}`} | ||
> | ||
<div | ||
className={`${rank === 1 ? styles.leaf1 : ''} ${ | ||
toggleMode === 'NORMAL' && styles.normal | ||
}`} | ||
> | ||
<div className={`${styles.intraId} ${rank === 1 && styles.first}`}> | ||
<Link href={`users/detail?intraId=${intraId}`}> | ||
<PlayerImage | ||
src={userImageUri} | ||
styleName={rank === 1 ? 'ranktropybig' : 'ranktropy'} | ||
size={50} | ||
/> | ||
<span>{intraId}</span> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ํผ๊ทธ๋ง ๋ณด์๋ฉด intraId๋ ์์์ ๋ฐ๋ผ ํฐํธ์๊น์ด ๋ฌ๋ผ์ง๋ ๊ฒ ๊ฐ์์!! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ์ ๊ฒ์์์ธ์ค ์์๋๋ฐ ๋ฑ์์ ๋ฐ๋ผ ์์์ด ๋ค ๋ค๋ฅด๋ค์ ๊ฐ์ฌํฉ๋๋ค! |
||
</Link> | ||
</div> | ||
<div | ||
className={`${ | ||
rank === 1 | ||
? styles.rankNumber1 | ||
: rank === 2 | ||
? styles.rankNumber2 | ||
: styles.rankNumber3 | ||
} ${toggleMode === 'NORMAL' && styles.normal}`} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ์ด๋ถ๋ถ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ์ข์ ๋ฐฉ๋ฒ ๊ฐ์ฌํฉ๋๋ค! |
||
> | ||
{rankFiltered} | ||
</div> | ||
</div> | ||
</div> | ||
<div className={styles.statusMessage}>{messageFiltered}</div> | ||
</div> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,27 @@ | ||
import { RankUser, NormalUser, Rank } from 'types/rankTypes'; | ||
import RankListItemMain from './RankListItemMain'; | ||
import styles from 'styles/rank/RankListMain.module.scss'; | ||
|
||
interface RankListMainProps { | ||
rank?: Rank; | ||
isMain: boolean; | ||
} | ||
|
||
export default function RankListMain({ rank }: RankListMainProps) { | ||
//const isNormalSeason = seasonMode === 'normal'; | ||
const isNormalSeason = false; | ||
const content = { | ||
normal: { style: styles.normal, title: 'VIP' }, | ||
rank: { style: '', title: 'Champion' }, | ||
both: { style: '', title: 'Champion' }, | ||
}; | ||
export default function RankListMain({ rank, isMain }: RankListMainProps) { | ||
const bangElements = Array.from({ length: 5 }, (_, index) => ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Array๋ฅผ ์ด๋ ๊ฒ๋ ๋ง๋ค ์ ์๊ตฐ์. ๋ฐฐ์๊ฐ๋๋ค!! ๐ |
||
<div | ||
key={index} | ||
className={`${rank?.rankList[1].rank === 1 && !isMain && styles.bang}`} | ||
/> | ||
)); | ||
|
||
return ( | ||
<div className={styles.mainContainer}> | ||
<div className={`${styles.title} ${content.rank.style}`}> | ||
{content.rank.title} | ||
<div> | ||
<div className={`${styles.bangContainer}`}>{bangElements}</div> | ||
<div className={`${styles.mainContainer} ${isMain && styles.isMain}`}> | ||
{rank?.rankList.map((item: NormalUser | RankUser) => ( | ||
<RankListItemMain key={item.intraId} user={item} /> | ||
))} | ||
</div> | ||
{rank?.rankList.map((item: NormalUser | RankUser) => ( | ||
<RankListItemMain | ||
key={item.intraId} | ||
user={item} | ||
isSeasonNormal={isNormalSeason} | ||
/> | ||
))} | ||
</div> | ||
); | ||
} |
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.
์ด ๋ถ๋ถ์ {toggleMode, season, isMain}: RankListProps๋ก ์ธ์ ์์์ ๊ตฌ์กฐ๋ถํดํด๋ ๋ ๊ฒ ๊ฐ์์!