-
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
16 changed files
with
188 additions
and
80 deletions.
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
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
62 changes: 62 additions & 0 deletions
62
app/ui/result/result-category-detail/result-category-detail-info.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,62 @@ | ||
import ResultCategoryDetailContent from '@/app/ui/result/result-category-detail-content/result-category-detail-content'; | ||
import { | ||
CreditResponse, | ||
LectureInfoResponse, | ||
ResultCategoryDetailLecturesResponse, | ||
useFetchCredits, | ||
useFetchResultCategoryDetailInfo, | ||
} from '@/app/store/querys/result'; | ||
import { ResultCategoryKey } from '../result-category-detail-content/result-category-detail-content.stories'; | ||
import { RESULT_CATEGORY } from '@/app/utils/key/result-category.key'; | ||
|
||
const CHAPEL_TOTAL_CREDIT = 2.0; | ||
const CHAPEL_TOTAL_COUNT = 4; | ||
const CHAPEL_CREDIT = CHAPEL_TOTAL_CREDIT / CHAPEL_TOTAL_COUNT; | ||
|
||
const CHAPEL_LECTURE_INFO: LectureInfoResponse = { | ||
id: 0, | ||
lectureCode: 'KMA02101', | ||
name: '채플', | ||
credit: CHAPEL_CREDIT, | ||
}; | ||
|
||
function addChapelToCommonCulture( | ||
info: ResultCategoryDetailLecturesResponse[], | ||
chapel?: CreditResponse, | ||
): ResultCategoryDetailLecturesResponse[] { | ||
if (!chapel) return info; | ||
const takenChapelCount = chapel.takenCredit / CHAPEL_CREDIT; | ||
const haveToChapelCount = Math.max(0, CHAPEL_TOTAL_COUNT - takenChapelCount); | ||
|
||
return [ | ||
...info, | ||
{ | ||
categoryName: '채플', | ||
completed: takenChapelCount >= CHAPEL_TOTAL_COUNT, | ||
totalCredit: CHAPEL_TOTAL_CREDIT, | ||
takenCredit: chapel.takenCredit, | ||
haveToLectures: Array(haveToChapelCount).fill(CHAPEL_LECTURE_INFO), | ||
takenLectures: Array(takenChapelCount).fill(CHAPEL_LECTURE_INFO), | ||
}, | ||
]; | ||
} | ||
|
||
export default function ResultCategoryDetailInfo({ category }: { category: ResultCategoryKey }) { | ||
const { data: categoryInfo } = useFetchResultCategoryDetailInfo(category); | ||
const { data: categories } = useFetchCredits(); | ||
|
||
const chapel = categories.find(({ category }) => category === 'CHAPEL'); | ||
const isCommonCulture = category === RESULT_CATEGORY.COMMON_CULTURE; | ||
const detailCategory = isCommonCulture | ||
? addChapelToCommonCulture(categoryInfo.detailCategory, chapel) | ||
: categoryInfo.detailCategory; | ||
|
||
return ( | ||
<ResultCategoryDetailContent | ||
takenCredit={categoryInfo.takenCredit} | ||
totalCredit={categoryInfo.totalCredit} | ||
detailCategory={detailCategory} | ||
category={category} | ||
/> | ||
); | ||
} |
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,16 @@ | ||
'use client'; | ||
import * as ChannelService from '@channel.io/channel-web-sdk-loader'; | ||
|
||
let channelTalkDidInit = false; | ||
|
||
export default function ChannelTalk() { | ||
if (typeof window !== 'undefined' && !channelTalkDidInit) { | ||
channelTalkDidInit = true; | ||
ChannelService.loadScript(); | ||
ChannelService.boot({ | ||
pluginKey: process.env.NEXT_PUBLIC_CHANNELTALK_PLUGIN ?? '', | ||
}); | ||
} | ||
|
||
return null; | ||
} |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.