-
Notifications
You must be signed in to change notification settings - Fork 0
FEAT - 통계 페이지 구현 및 API 연동 #37
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
Conversation
src/pages/StatisticsPage.tsx
Outdated
| const [strengths, setStrengths] = useState<string[]>([]); | ||
| const [weaknesses, setWeaknesses] = useState<string[]>([]); |
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.
| const [strengths, setStrengths] = useState<string[]>([]); | |
| const [weaknesses, setWeaknesses] = useState<string[]>([]); | |
| const [strengths, setStrengths] = useState<CardCategory[]>([]); | |
| const [weaknesses, setWeaknesses] = useState<CardCategory[]>([]); |
이렇게 바꾸면 아래에서 category as CardCategory 부분에서 as CardCategory를 제거할 수 있습니다.
src/pages/StatisticsPage.tsx
Outdated
| {!allEqual | ||
| ? [ | ||
| { data: strengths, isSurpassed: true, message: '분야에 강하시네요!' }, | ||
| { data: weaknesses, isSurpassed: false, message: '분야를 조금 더 공부해보아요!' }, | ||
| ].map( | ||
| ({ data, isSurpassed, message }) => | ||
| data.length > 0 && ( | ||
| <StatisticsTextContainer key={message} isSurpassed={isSurpassed}> | ||
| {data.map((category, index) => ( | ||
| <StatisticsCategory key={index}> | ||
| {CARD_CATEGORY_KO[category as CardCategory]} | ||
| {index < data.length - 1 ? ', ' : ''} | ||
| </StatisticsCategory> | ||
| ))} | ||
| {message} | ||
| </StatisticsTextContainer> | ||
| ), | ||
| ) | ||
| : categories[0].accuracy == 0 | ||
| ? '지금 당장 공부하러 가볼까요?' | ||
| : ''} |
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.
ternary 중첩은 진짜 지양해야 합니다...
if문으로 해결하던가 해주세요!
Ji-InPark
left a comment
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.
이거만 반영하고 머지해주세요~
| <StatisticsTextContainer key={message} isSurpassed={isSurpassed}> | ||
| {data.map((category, index) => ( | ||
| <StatisticsCategory key={index}> | ||
| {CARD_CATEGORY_KO[category as CardCategory]} |
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.
| {CARD_CATEGORY_KO[category as CardCategory]} | |
| {CARD_CATEGORY_KO[category]} |
📚 개요
🕐 리뷰 예상 시간
❗❗ 중요한 변경점(Option)
리뷰가 비교적 꼼꼼히 이루어져야할 부분이나 파일을 여기다 적어주거나
해당 로직에 직접 코멘트를 달아도 좋습니다