-
Notifications
You must be signed in to change notification settings - Fork 0
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
Result refactor/#137 #140
Result refactor/#137 #140
Changes from 10 commits
52e55ed
1cf2132
8caf438
89bf6a5
5682e15
fe2f9d9
e511297
351c0a8
a606dca
e3915c2
a140969
86f417d
eca4647
bbb0101
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ import AnnounceMessageBox from '@/app/ui/view/molecule/announce-message-box/anno | |
import LabelContainer from '@/app/ui/view/atom/label-container/label-container'; | ||
import { cn } from '@/app/utils/shadcn/utils'; | ||
import { ResultCategoryDetailLecturesResponse } from '@/app/store/querys/result'; | ||
import CompletedImage from '@/public/assets/completed-category.png'; | ||
|
||
const headerInfo = ['๊ณผ๋ชฉ์ฝ๋', '๊ณผ๋ชฉ๋ช ', 'ํ์ ']; | ||
|
||
|
@@ -15,6 +16,7 @@ function ResultCagegoryDetailLecture({ detailCategory, isTakenLecture }: ResultC | |
const { categoryName, totalCredit, takenCredit, takenLectures, haveToLectures, completed } = detailCategory; | ||
|
||
const showCompleted = !isTakenLecture && completed; | ||
const showNoneLecture = isTakenLecture && takenLectures.length === 0; | ||
|
||
return ( | ||
<div className={cn('my-4 flex flex-col gap-4 min-h-48', 'md:min-h-60')}> | ||
|
@@ -27,9 +29,12 @@ function ResultCagegoryDetailLecture({ detailCategory, isTakenLecture }: ResultC | |
} | ||
/> | ||
{showCompleted ? ( | ||
<AnnounceMessageBox message="ํด๋น ํํธ์ ์กธ์ ์๊ฑด์ ์ถฉ์กฑํ์ จ์ต๋๋ค!" /> | ||
<AnnounceMessageBox message="ํด๋น ํํธ์ ์กธ์ ์๊ฑด์ ์ถฉ์กฑํ์ จ์ต๋๋ค!" background_image={CompletedImage} /> | ||
) : ( | ||
<Table headerInfo={headerInfo} data={isTakenLecture ? takenLectures : haveToLectures} /> | ||
<> | ||
<Table headerInfo={headerInfo} data={isTakenLecture ? takenLectures : haveToLectures} /> | ||
{showNoneLecture && <AnnounceMessageBox message="์ด์ํ ๊ณผ๋ชฉ ์ ๋ณด๊ฐ ์กด์ฌํ์ง ์์ต๋๋ค." />} | ||
</> | ||
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. List component์์ props๋ก ๋ฐ๊ณ ์๋ |
||
)} | ||
</div> | ||
); | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,13 @@ | ||
import { InitUserInfoResponse, UserInfoResponse } from '@/app/business/services/user/user.type'; | ||
import InitUserAnnounce from './init-user-announce'; | ||
import UserInfoContent from './user-info-content'; | ||
import { fetchUser } from '@/app/business/services/user/user.query'; | ||
import { isInitUser } from '@/app/business/services/user/user.validation'; | ||
|
||
async function UserInfoCard() { | ||
const data = await fetchUser(); | ||
|
||
function isInitUser(x: UserInfoResponse | InitUserInfoResponse): x is InitUserInfoResponse { | ||
return typeof x.studentName === null; | ||
} | ||
|
||
function renderUserInfo(data: UserInfoResponse | InitUserInfoResponse) { | ||
return isInitUser(data) ? <InitUserAnnounce /> : <UserInfoContent data={data} />; | ||
return isInitUser(data) ? <></> : <UserInfoContent data={data} />; | ||
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. ๋์์ด ํ์ํ ๋ถ๋ถ ์ ์ฝ์ด๋ดค์ต๋๋ค. ์ ์๊ฐ์๋ ํ์ ๋จ์ธ๋ณด๋ค ๊ธฐ์กด ์ฝ๋๊ฐ ๋ ์ ์ ํฉ๋๋ค. ์ด์ ๋ ํ์ ๋จ์ธ์ ์ฌ์ฉํ๋ฉด ๋ ผ๋ฆฌ์ ๋ฌธ์ ๊ฐ ์๊ธฐ๊ณ ์๊ธฐ์น ์์ ์ค๋ฅ๊ฐ ๋ฐ์ํ ์ ์๊ธฐ ๋๋ฌธ์ ๋๋ค. user-info-card๋ user ๋๋ฉ์ธ์ ์์นํ ๋๋ฉ์ธ ์ปดํฌ๋ํธ์ด๋ฏ๋ก, ์ด ์ปดํฌ๋ํธ๊ฐ ์ด๋ ํ์ด์ง์์ ์ฌ์ฉ๋๋์ง๋ ๊ด์ฌ์ฌ๋ฅผ ๋ฒ์ด๋ฉ๋๋ค. ํ์ฌ ๋ ผ์์์๋ ์ด ์ปดํฌ๋ํธ๊ฐ ๊ฒฐ๊ณผ ํ์ด์ง์์๋ง ์ฌ์ฉ๋๋ค๊ณ ๊ฐ์ ํ๊ณ initUser๋ฅผ ๊ณ ๋ คํ์ง ์์๋ ๋๋ค๊ณ ์๊ฐํ์ง๋ง, ์ค์ ๋ก๋ ์ด๋ ํ์ด์ง์์ ์ด ์ปดํฌ๋ํธ๊ฐ ์ฌ์ฌ์ฉ๋ ์ง ๋ชจ๋ฅด๊ธฐ ๋๋ฌธ์ ํ์ ๋จ์ธ์ ์ฌ์ฉํ๋ฉด ์ฌ์ฌ์ฉ์ฑ์ด ๋จ์ด์ง ์ ์์ต๋๋ค. ๋ฌผ๋ก ํ์ ๋จ์ธ์ ํด๋ ๋น์ฅ์ ๋ฌธ์ ๊ฐ ์๊ธฐ์ง ์๊ฒ ์ง๋ง, ์ด ์ปดํฌ๋ํธ๋ result ํ์ด์ง์ ๊ฐ์ด ์ ์ ๊ฐ ์ด๋ฏธ ์ด๊ธฐํ๋ ๊ณณ์์๋ง ์ฌ์ฉํ ์ ์๊ฒ ๋ฉ๋๋ค. ์คํ๋ ค ์ด๋ ๊ฒ ๋๋ฉด ์ฝ๋๋ฅผ ์ดํดํ๊ธฐ ๋ ์ด๋ ต๊ฒ ๋ง๋ค๊ณ ์ฌ์ฌ์ฉ์ฑ์ ๋จ์ดํธ๋ฆฐ๋ค ์๊ฐํฉ๋๋ค. ์๋ฅผ ๋ค์ด, ์๋ก์ด ๋๋ฃ ๊ฐ๋ฐ์๊ฐ ์ ํ์ด์ง๋ฅผ ๊ฐ๋ฐํ๋ฉด์ ์ด ์ปดํฌ๋ํธ๋ฅผ ์ฌ์ฌ์ฉํ๋ ค ํ ๋, ์ด๊ธฐํ๋์ง ์์ ์ ์ ๋ก ์ธํด ์์์น ๋ชปํ ๋ฌธ์ ๊ฐ ๋ฐ์ํ ์ ์์ต๋๋ค. ํด๊ฒฐ ๋ฐฉ๋ฒ์ ๋ ๊ฐ์ง๊ฐ ์์ต๋๋ค. ์ฒซ์งธ, ๊ธฐ์กด๋๋ก ์ด๊ธฐํ๋์ง ์์ ์ ์ ๋ฅผ ์ฒ๋ฆฌํ๋ ๋ก์ง์ ๋ง๋๋ ๊ฒ์ ๋๋ค. ๋์งธ, ๋ง์ฝ ์ด ์ปดํฌ๋ํธ๊ฐ ๊ฒฐ๊ณผ ํ์ด์ง ์ธ์๋ ์ฌ์ฉ๋์ง ์์ ๊ฒ์ด ํ์คํ๊ธฐ์ ์ฌ์ฌ์ฉ์ฑ์ ๊ณ ๋ คํ๊ณ ์ถ์ง ์๋ค๋ฉด, ์ํคํ ์ฒ์ ์์น๋ฅผ ๋ณ๊ฒฝํ์ฌ ๊ฒฐ๊ณผ ํ์ด์ง ์ ์ฉ ์ปดํฌ๋ํธ์์ ๋ช ํํ ํ๋ ๊ฒ์ ๋๋ค. ๋ฒ์ธ๋ก ์ ๋ ๊ธฐ์กด InitUserAnnounce ์ปดํฌ๋ํธ์ฒ๋ผ (์๋๋ฉด ์ปดํฌ๋ํธ ๋ช ์ ์ฐจ๋ผ๋ฆฌ NoData์ ๊ฐ์ด ๋ฌธ์ ๊ฐ ์์์ ๋ํ๋ด๋ ๋ฐฉ์์ผ๋ก ํํํด๋ ๋ฉ๋๋ค) "์ฑ์ ํ PDF๋ฅผ ์ ๋ก๋ํด์ผ ์กธ์ ์ฌ์ ๊ฒฐ๊ณผ๋ฅผ ํ์ธํ ์ ์์ด์."๋ผ๊ณ ์๋ ค์ฃผ๋ ๊ฒ ๋๋ฃ ๊ฐ๋ฐ์๊ฐ ์ฝ๋๋ฅผ ์ฝ์ ๋๋ ๋ ์ดํด๊ฐ ์ ๋ ๊ฑฐ๋ผ๊ณ ์๊ฐ์ด ๋๋ค์. 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. user-info-card๊ฐ ๋๋ฉ์ธ ์ปดํฌ๋ํธ๋ผ๋ ๊ฐ์ ์ ๋์น๊ณ ์์๋ค์. ์๊ฒฌ ๊ฐ์ฌํฉ๋๋ค! bbb0101 |
||
} | ||
|
||
return <>{renderUserInfo(data)}</>; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export const getPercentage = (numerator: number, denominator: number) => { | ||
return Number(((numerator / denominator) * 100).toFixed(0)); | ||
const percentage = Number(((numerator / denominator) * 100).toFixed(0)); | ||
return percentage > 100 ? 100 : percentage; | ||
}; |
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.
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.
a606dca