-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
22 changed files
with
392 additions
and
55 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,33 @@ | ||
import { LectureInfo } from '@/app/type/lecture'; | ||
import { API_PATH } from '../api-path'; | ||
|
||
export interface ResultCategoryDetailLectures { | ||
categoryName: string; | ||
totalCredits: number; | ||
takenCredits: number; | ||
takenLectures: LectureInfo[]; | ||
haveToLectures: LectureInfo[]; | ||
completed: boolean; | ||
} | ||
|
||
export interface ResultCategoryDetailInfo { | ||
totalCredit: number; | ||
takenCredit: number; | ||
detailCategory: ResultCategoryDetailLectures[]; | ||
completed: boolean; | ||
} | ||
|
||
export interface ResultUserInfo { | ||
studentNumber: string; | ||
studentName: string; | ||
studentCategory: 'NORMAL' | 'CHANGE_MAJOR' | 'DUAL_MAJOR' | 'SUB_MAJOR'; | ||
major: string; | ||
totalCredit: number; | ||
takenCredit: number; | ||
} | ||
|
||
export const fetchResultCategoryDetailInfo = async (): Promise<ResultCategoryDetailInfo> => { | ||
const response = await fetch(API_PATH.resultCategoryDetailInfo); | ||
const data = await response.json(); | ||
return data; | ||
}; |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import { resultHandlers } from './result-handler.mock'; | ||
import { takenLectureHandlers } from './taken-lecture-handler.mock'; | ||
import { userHandlers } from './user-handler.mock'; | ||
|
||
export const handlers = [...userHandlers, ...takenLectureHandlers]; | ||
export const handlers = [...userHandlers, ...takenLectureHandlers, ...resultHandlers]; |
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,11 @@ | ||
import { HttpResponse, http, delay } from 'msw'; | ||
import { API_PATH } from '../../business/api-path'; | ||
import { mockDatabase } from '../db.mock'; | ||
|
||
export const resultHandlers = [ | ||
http.get(API_PATH.resultCategoryDetailInfo, async () => { | ||
const resultCategoryDetailInfo = mockDatabase.getResultCategoryDetailInfo(); | ||
await delay(100); | ||
return HttpResponse.json(resultCategoryDetailInfo); | ||
}), | ||
]; |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { atom } from 'jotai'; | ||
import { LectureInfo } from '../type/lecture'; | ||
import { TakenLectrueInfo } from '../type/lecture'; | ||
|
||
export const takenLectureAtom = atom<LectureInfo[]>([]); | ||
export const takenLectureAtom = atom<TakenLectrueInfo[]>([]); | ||
|
||
export const swipeTakenLectureAtom = atom<LectureInfo[]>([]); | ||
export const swipeTakenLectureAtom = atom<TakenLectrueInfo[]>([]); |
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
'use client'; | ||
import { takenLectureAtom } from '@/app/store/custom-taken-lecture'; | ||
import { LectureInfo } from '@/app/type/lecture'; | ||
import { TakenLectrueInfo } from '@/app/type/lecture'; | ||
import { useHydrateAtoms } from 'jotai/utils'; | ||
|
||
export default function TakenLectureAtomHydrator({ | ||
initialValue, | ||
children, | ||
}: React.PropsWithChildren<{ initialValue: LectureInfo[] }>) { | ||
}: React.PropsWithChildren<{ initialValue: TakenLectrueInfo[] }>) { | ||
useHydrateAtoms(new Map([[takenLectureAtom, initialValue]])); | ||
return children; | ||
} |
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
37 changes: 37 additions & 0 deletions
37
app/ui/result/result-category/result-cagegory-detail-lecture.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,37 @@ | ||
import { Table } from '../../view/molecule/table'; | ||
import AnnounceMessageBox from '@/app/ui/view/molecule/announce-message-box/announce-massage-box'; | ||
import { ResultCategoryDetailLectures } from '@/app/business/result/result.query'; | ||
import LabelContainer from '@/app/ui/view/atom/label-container/label-container'; | ||
|
||
const headerInfo = ['과목코드', '과목명', '학점']; | ||
|
||
interface ResultCagegoryDetailLectureProps { | ||
detailCategory: ResultCategoryDetailLectures; | ||
isTakenLecture: boolean; | ||
} | ||
|
||
function ResultCagegoryDetailLecture({ detailCategory, isTakenLecture }: ResultCagegoryDetailLectureProps) { | ||
const { categoryName, totalCredits, takenCredits, takenLectures, haveToLectures, completed } = detailCategory; | ||
|
||
const showCompleted = !isTakenLecture && completed; | ||
|
||
return ( | ||
<div className="my-4 flex flex-col gap-4"> | ||
<LabelContainer | ||
label={categoryName} | ||
rightElement={ | ||
<div className="text-2xl text-gray-6"> | ||
{takenCredits} / {totalCredits} | ||
</div> | ||
} | ||
/> | ||
{showCompleted ? ( | ||
<AnnounceMessageBox message="해당 파트의 졸업요건을 충족하셨습니다!" /> | ||
) : ( | ||
<Table headerInfo={headerInfo} data={isTakenLecture ? takenLectures : haveToLectures} /> | ||
)} | ||
</div> | ||
); | ||
} | ||
|
||
export default ResultCagegoryDetailLecture; |
Oops, something went wrong.